ios - tableview scroll到bottom时,cell有时候会遮挡住一部分

 豆伊一 发布于 2022-10-31 09:48

RT, 我是这么设置的, 但如图所示,有时候回遮挡住cell的内容, 有时候不会

 self.tableView.scrollToRowAtIndexPath(NSIndexPath(forRow: self.messages().count-1, inSection: 0), atScrollPosition: UITableViewScrollPosition.Bottom, animated: false)
 
 

http://stackoverflow.com/questions/25686490/ios-8-auto-cell-height-cant-scroll-to-last-row 和这个问题类似

3 个回答
  • 你的frame的高度过高 设置下frame或者设置约束 位置在哪个输入框之上就行了

    iOS有问必答社区为你回答
    426981364
    有问题可以扣群上问

    2022-10-31 22:36 回答
  • 我用了http://stackoverflow.com/questions/25686490/ios-8-auto-cell-height-cant-scroll-to-last-row 中说的这个方法 就解决了, 但不知道为什么, 谁能解释一下?

     if array.count > 0 {
            let indexPath: NSIndexPath = NSIndexPath(forRow: array.count - 1, inSection: 0)
            self.tblView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Bottom, animated: true)
            let delay = 0.1 * Double(NSEC_PER_SEC)
            let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
    
            dispatch_after(time, dispatch_get_main_queue(), {
                self.tblView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Bottom, animated: true)
            })
        }
    2022-10-31 22:36 回答
  • self.automaticallyAdjustsScrollViewInsets = NO;
    加上这句看看

    2022-10-31 22:36 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有