最新消息:服务器现已从linode换到fzhost.net,且主题已从retina 0.2换为大前端D8

[基本解决]Swift在TableView添加section和row行然后滚动

Swift crifan 56浏览 0评论

想要实现,在append了对应的item后,再去滚动:

            gContactViewController?.contactTableView.beginUpdates()
           
let itemIndexPath:NSIndexPath = NSIndexPath(forRow: indexInSection, inSection: sectionIdx)
           
print("itemIndexPath=\(itemIndexPath)")
           
           
//check is append or insert
            gContactViewController?.contactTableView.insertRowsAtIndexPaths(
                [itemIndexPath],
                withRowAnimation:
UITableViewRowAnimation.Automatic)
           
gContactViewController?.contactTableView.endUpdates()
            gContactViewController?.contactTableView.scrollToRowAtIndexPath(itemIndexPath, atScrollPosition: UITableViewScrollPosition.Middle, animated: true)

但是运行失败。

swift tableview append section scroll

 Programmatic UITableView Scrolling – Grok Swift

ios – How do i automatically scroll in a table view? Using swift – Stack Overflow

swift tableview append section

ios – Adding sections, separated by dates, to UITableView in Swift – Stack Overflow

Add Rows to Table View Tutorial in iOS8 with Swift – iOScreator

swift tableview append row

Inserting and Deleting Rows and Sections

insertRowsAtIndexPaths(_:withRowAnimation:) – UITableView Class Reference

[基本搞懂]swift中UITableView中如何只刷新某个section的某个单独的行

[已解决]swift中已更新对应行的数据源但tableView的reloadRowsAtIndexPaths却还是出错崩溃:attempt to delete row 0 from section 0 which only contains 0 rows before the update

转载请注明:在路上 » [基本解决]Swift在TableView添加section和row行然后滚动

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
51 queries in 0.551 seconds, using 13.25MB memory