we can disable the tableview scrolling in multiple ways.
1) In textView delegate methods
- (void)textViewDidBeginEditing:(UITextView *)textView{
tableView.scrollEnabled = NO;
}
- (void)textViewDidEndEditing:(UITextView *)textView{
tableView.scrollEnabled = YES;
}
2) Keyboard Notifications
- (void)viewWillAppear:(BOOL)animated{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:self.view.window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification object:self.view.window];
}
- (void)viewWillDisappear:(BOOL)animated {
// unregister for keyboard notifications while not visible.
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];}
- (void)keyboardWillShow:(NSNotification *)notif {
tableView.scrollEnabled = NO;
}
- (void)keyboardWillHide:(NSNotification *)notif {
tableView.scrollEnabled = YES;
}