类似QQ的聊天框,当进入聊天框,直接滑动倒最底部;

需要先将以他变了view滚动倒底部,再来移动NSIndexPath,

代码如下:

-(void) doForceScrollToBottom
{    
    dispatch_async(dispatch_get_main_queue(), ^
                   {
                      if(  self.mTableViewConsult.contentSize.height - self.mTableViewConsult.contentOffset.y > self.mTableViewConsult.frame.size.height )
                       {
                          [self.mTableViewConsult setContentOffset:CGPointMake(0, self.mTableViewConsult.contentSize.height - self.mTableViewConsult.frame.size.height)];
                       }
                      
                      usleep(5000);
                      
                      NSIndexPath* path = [NSIndexPath indexPathForRow: nMaxTableCount - 1 inSection:0];
                      if( path )
                       {
                          [self.mTableViewConsult scrollToRowAtIndexPath:path atScrollPosition:UITableViewScrollPositionBottom animated:NO];
                       }
                });
}

 

相关文章:

  • 2021-12-03
  • 2021-12-06
  • 2021-10-19
  • 2022-01-07
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
相关资源
相似解决方案