Skip to content

Instantly share code, notes, and snippets.

@dpfannenstiel
Last active September 6, 2015 10:12
Show Gist options
  • Save dpfannenstiel/74307cbea3fd72d05ab0 to your computer and use it in GitHub Desktop.
Save dpfannenstiel/74307cbea3fd72d05ab0 to your computer and use it in GitHub Desktop.
Swift Keyboard Gists

Swift Keyboard Gists

Notification Center Registration

Add these lines to register for keyboard notifications.

	NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow:", name: UIKeyboardWillShowNotification, object: nil)
	NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardDidShow:", name: UIKeyboardDidShowNotification, object: nil)
	NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillHide:", name: UIKeyboardWillHideNotification, object: nil)
	NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardDidHide:", name: UIKeyboardDidHideNotification, object: nil)

Methods

These methods will recieve the notifications.

	func keyboardWillShow(notification: NSNotification) {

	}
	
	func keyboardDidShow(notification: NSNotification) {

	}
	
	func keyboardWillHide(notification: NSNotification) {

	}
	
	func keyboardDidHide(notification: NSNotification) {

	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment