I am developing an chat app, i have used tableview to display the messages sent and receive and a view with textfield and add button at the bottom. On clicking add button action sheet is displayed with options Everything works fine except, when i click on add button and tap cancel button of action sheet and then tap on textfield....tableview does not scroll up when keyboard is shown
Below is the code for keyboardwillshow notification
KeyboardWillShow :
NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey];
NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey];
CGRect keyboardBounds;
[keyboardBoundsValue getValue:&keyboardBounds];
NSNumber *duration = [notification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [notification.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
// Need to translate the bounds to account for rotation.
keyboardBounds = [self.view convertRect:keyboardBounds toView:nil];
CGRect containerFrame = viewDummy.frame;// viewDummy is the view where keyboard, add button and speak button is displayed
containerFrame.origin.y = self.view.bounds.size.height - (keyboardBounds.size.height + containerFrame.size.height);
NSLayoutConstraint *constPaddingwithViewTable.constant = keyboardBounds.size.height + containerFrame.size.height;
// animations settings
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:[duration doubleValue]];
[UIView setAnimationCurve:[curve intValue]];
// set views with new info
viewDummy.frame = containerFrame;
// commit animations
[UIView commitAnimations];
}