I have a little problem with UIScrollView. Basically, I use the code from the PageControl sample application with some changes. I am adding a scroll view to my navigation stack, I want it to be on a specific page when it gets there. I'm trying to use the UIScrollView scrollToRect: animated method, but even if I pass NO, it still animates! Here's the code snippet:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = indexPath.row;
viewController.currentPage = row;
CGRect frame = viewController.scrollView.frame;
frame.origin.x = frame.size.width * row;
frame.origin.y = 0;
[viewController.scrollView scrollRectToVisible:frame animated:NO];
[self.navigationController pushViewController:viewController animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
Does anyone know why?
Thank!
source
share