I used the below couple of code lines to get the frame of the keyboard when its shown on the screen. I've registered to UIKeyboardDidShowNotification
notification.
func keyboardWasShown(notification: NSNotification) {
var info = notification.userInfo
var keyboardFrame: CGRect = info.objectForKey(UIKeyboardFrameEndUserInfoKey).CGRectValue()
}
This used to work in beta 5. I downloaded the latest Xcode 6 version which is beta 6 and this error occurred at the second line.
'[NSObject : AnyObject]?' does not have a member named 'objectForKey'
After some Googling, I came across this solution. And I changed it like so,
var keyboardFrame: CGRect = (info[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue()
But it seems that's also outdated now. Because I get this error now.
'[NSObject : AnyObject]?' does not have a member named 'subscript'
I can't figure out this error or how to resolve it.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…