UITableView is a very powerful class, powering many navigation and preference views on iPhone. Many people have come up with useful UITableView tips, tricks and samples:
Please post your favourite tips on using UITableView, one tip per question. I'll start by posting the ones I found on Stack Overflow and the ones from my bookmarks.
Ever wondered what UITableViewController really does?
In viewWillAppear, it deselects any selected rows, with animated:YES
.
This by the way is why when you navigate back in UINavigationController, the row you've previously touched is nicely deselected with animation. When you pushed a new view controller onto UINavigationController, you've left the row selected. When you pop it and go back to the table view, viewWillAppear fires and deselects the row. UINavigationController does not even know about this happening.
In viewWillAppear, it calls reloadData
if the table view contains no rows.
In viewDidAppear, it calls flashScrollIndicators
.
It monitors the keyboard appearing and disappearing and resizes the table view appropriately so that when you tap a text field in a table view, it remains visible after the keyboard appears.
If you don't need the keyboard monitoring behaviour, it is fairly easy to do everything else yourself if you need to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With