views:

46

answers:

0

Hi Everyone!

I have a little problem with UIScrollView. Basically, I'm using the code from the PageControl sample app with some modification. I'm adding the scroll view to my navigation stack, I want it to be on a specific page when it gets there. I am trying to use the UIScrollView scrollToRect: animated: method, but even though I pass in NO, it's still animating! Here's a 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?

Thanks!