search

Home  >  Q&A  >  body text

ios - 我一个tableView滑动到底部,但是总是没有滑动到最底部,会有一小段没滑动下去

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下面还有一小段 没有滑动到底的

问:谁知道为什么会这样么?

高洛峰高洛峰2771 days ago1339

reply all(11)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 09:53:17

    Is the input field below covering the content below? Try setting contentOffset or contentInset.

    reply
    0
  • PHPz

    PHPz2017-04-18 09:53:17

    The row of indexPath is wrong, right?

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:53:17

    Should we set the attribute automaticallyAdjustsScrollViewInsets? The height doesn’t look like 64 either

    reply
    0
  • 黄舟

    黄舟2017-04-18 09:53:17

    1. Make sure the tableView frame is OK

    2. Make sure tableView reload is complete

    3. Try scroll to contentOffset (max,max)

    reply
    0
  • ringa_lee

    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 = ·······
    

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 09:53:17

    1. You reset the tableView’s frame in viewWillAppear; you can print “tableView’s frame” here

    2. Also check if the row height is correct.

    3. If not, set ContentOffset

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-18 09:53:17

    [tableView setContentOffset:CGPointMake(CGFLOAT_MAX, CGFLOAT_MAX)];

    reply
    0
  • 阿神

    阿神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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:53:17

    Have you solved it? I also encountered the same problem

    reply
    0
  • 阿神

    阿神2017-04-18 09:53:17

    How to solve this problem

    reply
    0
  • Cancelreply