美文网首页iOS开发
弹出键盘时,让table向上移动

弹出键盘时,让table向上移动

作者: stillwalking | 来源:发表于2015-06-18 10:27 被阅读262次

原文链接:iphone 中弹出输入法键盘的时候,让table向上移动。

#pragma mark UITextFieldDelegate

- (BOOL)textFieldShouldBeginEditing: (UITextField *)textField
{
[UIView beginAnimations: nil context: nil];
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 280, 0);
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:textField.tag - tag_index_cell_start inSection: 0];
[self.tableView scrollToRowAtIndexPath: indexPath 
  atScrollPosition: UITableViewScrollPositionBottom 
  animated: YES];
[UIView commitAnimations];
return YES;
}

相关文章

网友评论

    本文标题:弹出键盘时,让table向上移动

    本文链接:https://www.haomeiwen.com/subject/hossqttx.html