I am attempting to resize a UITextView on keyboard show. However, my below code is behaving oddly. The text view jumps to the new height, then animates back to it's original height. Any help here would be appreciated.
//Handles keyboard appearance
func keyboardWillShow(notification:NSNotification){
var rightButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, target: self, action: Selector("dismissKeyboard"))
self.navigationItem.rightBarButtonItem = rightButton
self.origNoteFrame = notes.frame
var duration = NSTimeInterval((notification.userInfo![UIKeyboardAnimationDurationUserInfoKey] as NSNumber).intValue)
var options = UIViewAnimationOptions(
UInt((notification.userInfo![UIKeyboardAnimationCurveUserInfoKey] as NSNumber).integerValue << 16)
)
UIView.animateWithDuration(
duration,
delay: 0.0,
options: options,
animations: {
self.notes.frame = CGRectMake(self.notes.frame.origin.x, self.notes.frame.origin.y, self.notes.frame.width, (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue().origin.y - 10)
},
completion: nil)
}