ios - tableview scroll到bottom时,cell有时候会遮挡住一部分
迷茫
迷茫 2017-04-17 15:58:29
[iOS讨论组]

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)
天蓬老师

self.automaticallyAdjustsScrollViewInsets = NO;
加上这句看看

阿神

我用了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)
        })
    }
PHP中文网

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

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号