UITableView move to cell

前端 未结 3 1256
小鲜肉
小鲜肉 2020-12-09 01:02

I want to make next:

I have an UITableView that have to dispaly words (A-Z).

Currently when view did load I have one cell that displayed (and this is correct

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 01:37

    One can identify the row(in the eg. below it is forRow) that needs to be made visible and reload the row. Upon the completion of that one can scroll to that row.

    let moveToIndexPath = NSIndexPath(forRow: forRow, inSection: 0)
    self.tableView.reloadRowsAtIndexPaths([moveToIndexPath], withRowAnimation: .None)
    self.tableView.scrollToRowAtIndexPath(moveToIndexPath, atScrollPosition: atScrollPosition, animated: true)
    

提交回复
热议问题