Home  >  Q&A  >  body text

iOSTableview问题 如图

如图蓝色框代表Tableview的大小,左边的图代表Tableview的默认显示,框内显示前面的数据。
右边的图是我想要实现的效果。默认显示最后的数据。我这里还要实现添加一条数据后,把第7行向上挤。这里显示第3到第8行的数据。
就是类似QQ发消息的情况。请问怎么做

PHP中文网PHP中文网2741 days ago250

reply all(3)I'll reply

  • 黄舟

    黄舟2017-04-18 09:27:23

    I found a simpler way

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

    But there is one thing I need to increase my cells. There is no animation effect when I increase them using this method.

    reply
    0
  • PHPz

    PHPz2017-04-18 09:27:23

    In ViewDidAppear, get the indexpath (that is, the last row), and then call SrollToRowAtIndexPath of tableView. Remember to turn off the animation effect. .

    reply
    0
  • PHPz

    PHPz2017-04-18 09:27:23

    srollToRowAtIndexPath

    reply
    0
  • Cancelreply