Reputation: 954
I'm trying to implement an UIKeyboardWillShowNotification
to handle my view position when the keyboard appear.
I add my observer:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow", name: UIKeyboardWillShowNotification, object: nil)
Then I have the keyboardWillShow
function:
func keyboardWillShow(notification: NSNotification){
//Need to access to the notification here
}
In the function keyboardWillShow
I need to receive the NSNotification
to get access to the user information but I get this error:
"unrecognized selector sent to instance 0x7fd993e7d020"
Upvotes: 2
Views: 1578
Reputation: 53112
You forgot the colon :
. Change it to this:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow:", name: UIKeyboardWillShowNotification, object: nil)
Upvotes: 9