想要实现,在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