Skip to content

Commit 4f8a9c6

Browse files
committed
update for 6.1
1 parent e69ea57 commit 4f8a9c6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

bk2ch10p531selfSizingTextView/ch23p811selfSizingTextField/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ViewController: UIViewController, UITextViewDelegate {
2727
"all mimsy were the borogoves, and the mome raths outgrabe."
2828

2929
let mas = NSMutableAttributedString(string:s, attributes:[
30-
NSFontAttributeName: UIFont(name:"GillSans", size:20)
30+
NSFontAttributeName: UIFont(name:"GillSans", size:20)!
3131
])
3232

3333
mas.addAttribute(NSParagraphStyleAttributeName,

bk2ch10p532textViewAndKeyboard/ch23p811selfSizingTextField/ViewController.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class ViewController: UIViewController, UITextViewDelegate {
1515
super.viewDidLoad()
1616

1717
let path = NSBundle.mainBundle().pathForResource("brillig", ofType: "txt")!
18-
let s = String.stringWithContentsOfFile(path, encoding: NSUTF8StringEncoding, error: nil)
18+
let s = String(contentsOfFile:path, encoding: NSUTF8StringEncoding, error: nil)
1919
let s2 = s!.stringByReplacingOccurrencesOfString("\n", withString: "")
2020
let mas = NSMutableAttributedString(string:s2, attributes:[
21-
NSFontAttributeName: UIFont(name:"GillSans", size:20)
21+
NSFontAttributeName: UIFont(name:"GillSans", size:20)!
2222
])
2323

2424
mas.addAttribute(NSParagraphStyleAttributeName,
@@ -48,7 +48,8 @@ class ViewController: UIViewController, UITextViewDelegate {
4848
self.keyboardShowing = true
4949

5050
let d = n.userInfo!
51-
let r = (d[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue()
51+
var r = (d[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue()
52+
r = self.tv.superview!.convertRect(r, fromView:nil)
5253
// let duration = d[UIKeyboardAnimationDurationUserInfoKey] as NSNumber
5354
let f = self.tv.frame
5455
let fs = self.tv.superview!.bounds

0 commit comments

Comments
 (0)