'ScrollToRowAtIndexPath' method does not work for 'iPad 3.2 Simulator'
For a part of my app, I require the table view to scroll to the first row again. I used the following code.
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0
inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath
atScrollPosition:UITableViewScrollPositionTop
animated:NO];
I tested the app on both the 'iPad 4.2 Simulator' and 'iPad 4.3 Simulator' and they worked fine. However the app crashed when I switched to 'iPad 3.2 Simulator' with the f开发者_高级运维ollowing error
* Terminating app due to uncaught exception 'NSRangeException', reason: '-[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:]: section (0) beyond bounds (0).'
What am I doing wrong here? Also why does it work only for iPad 4.2 and 4.3 simulators but not the 3.2 one? I checked and understand that the scrollToRowAtIndexPath:
method is available for iOS (2.0 and later).
精彩评论