Reputation:
I am trying to use the code below however Xcode tells me UIKeyboardBoundsUserInfoKey is deprecated and I was wondering what the newer code was instead:
NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];
And below is the code in context:
-(void) keyboardDidHide: (NSNotification *)notif {
NSDictionary* info = [notif userInfo];
NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];
CGSize keyboardSize = [aValue CGRectValue].size;
CGRect viewFrame = self.view.frame;
viewFrame.size.height += keyboardSize.height;
scrollView.frame = viewFrame;
if (!keyboardVisible) {
//NSLog(@"Keyboard is already hidden. Ignoring notification.");
return;
}
keyboardVisible = NO;
}
Upvotes: 2
Views: 2642
Reputation: 4920
You can use the UIKeyboardFrameBeginUserInfoKey or UIKeyboardFrameEndUserInfoKey key instead of UIKeyboardBoundsUserInfoKey.
Upvotes: 9