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

阅读 5.4k
3 个回答

我用了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)
        })
    }

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

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

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题