1,想做一个会话界面,进来的时候滑动到最底部。
2,但是滑动到最底部的代码 使用之后,并没有滑动到最底部,总是差一截。
3,并不是那种底部有一段不能滑动上来的那种错误,是可以滑动上来的,就是在进来这个view的时候,不能直接滑动到最底部
4,这是我的代码
let indexPath = NSIndexPath(forRow: self.chatMessageModel.contentType.count-1, inSection: 0)
self.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Bottom, animated: false)
5,这张图是我进会话的view之后的样子
6,这张图红框标出的就是tableView下面还有一小段 没有滑动到底的
问:谁知道为什么会这样么?
大家讲道理2017-04-18 09:53:17
Is the input field below covering the content below? Try setting contentOffset or contentInset.
高洛峰2017-04-18 09:53:17
Should we set the attribute automaticallyAdjustsScrollViewInsets? The height doesn’t look like 64 either
黄舟2017-04-18 09:53:17
Make sure the tableView frame is OK
Make sure tableView reload is complete
Try scroll to contentOffset (max,max)
ringa_lee2017-04-18 09:53:17
[tableView setContentOffset:CGPointMake(CGFLOAT_MAX, CGFLOAT_MAX)];
This allows the Tableview to directly display the following
This is OC code, just find the same method in Swift.
I guess it is
tableview.ContentOffset = ·······
怪我咯2017-04-18 09:53:17
You reset the tableView’s frame in viewWillAppear; you can print “tableView’s frame” here
Also check if the row height is correct.
If not, set ContentOffset
阿神2017-04-18 09:53:17
Has the problem been solved? I also encountered the same problem and I don’t know how to solve it