【发布时间】:2018-09-03 10:48:52
【问题描述】:
我已阅读https://stackoverflow.com/questions/
并尝试如下:
//UITableView
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 50;
//Update the full code for the "return" key action
- (void)inputViewDidTapReturn:(MyInputView *)inputView text:(NSString *)text{
NSLog(@"send text-----%@",text);
[self.messageManager sendMessageTo:self.sessionID message:text completion:^(BOOL success, Message *message) {
if (success) {
[self.dataArray addObject:message];
NSIndexPath * bottomIndexPath = [NSIndexPath indexPathForRow:self.dataArray.count-1 inSection:0];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[bottomIndexPath] withRowAnimation:UITableViewRowAnimationLeft];
[self.tableView endUpdates];
[self.tableView scrollToRowAtIndexPath:bottomIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
} else {
}
}];
}
但是结果显示不正确:
它从屏幕底部开始滚动。
UITableView 和 UITableViewCell 都使用自动布局,UITableView 已经在键盘顶部。
任何帮助将不胜感激。
【问题讨论】:
标签: ios uitableview autolayout ios-autolayout