I've came on some sort of bug (I guess)... In my viewDidLoad:
after fetching and doing other stuff I scroll UITableView
to the nearest date in future. I use for this my method but basicaly it becomes to call scrollToRowAtIndexPath:atScrollPosition:animated:
. Everything is working good as I call this method from a button action or after UITableView
is reloaded but...
When I run thsis app on iPhone 4S (real device) it doesn't scroll me to this row in viewDidLoad
but lists me that this method was executed properly! What is more, when I run this in simulator (5 or 5S) everything works like charm! This code doesn't even work when I run this in iPhone 4 simulator... Why? Was there some sort of chanange which need to determine what kinde of device am I using?
I would suggest to have a look at two options:
1) Instead of viewDidLoad
you should move your scrolling logic to viewDidAppear
or after some delay
2) Handle this delegate and once the desired cell loaded scroll to its position:
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath NS_AVAILABLE_IOS(6_0)
{
if(indexPath.row == someFutureDateRowNumber)
{
// TODO : do scrolling here.
}
}