iOS 8 Auto cell height - Can't scroll to last row

前端 未结 12 1233
慢半拍i
慢半拍i 2020-11-28 20:50

I am using iOS 8 new self-sizing cells. Visually it works good - each cell gets its right size. However, if I try to scroll to the last row, the table view

12条回答
  •  猫巷女王i
    2020-11-28 21:33

    Use this simple code to scroll bottom

     var rows:NSInteger=self.tableName.numberOfRowsInSection(0)
            if(rows > 0)
            {
                let indexPath = NSIndexPath(forRow: rows-1, inSection: 0)
                tableName.scrollToRowAtIndexPath(indexPath , atScrollPosition:  UITableViewScrollPosition.Bottom, animated: true)
            }
                }
    

提交回复
热议问题