Sunday, February 14, 2010

Programmer - Scroll table to top causes crash

Programmer Question

I've tried:



- (IBAction)openSearch {
[tblSimpleTable scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
[searchBar becomeFirstResponder];
}


and



- (IBAction)openSearch {
[self.tblSimpleTable scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
[searchBar becomeFirstResponder];
}


to get the table to scroll to the top. Both work when the table is only slightly scrolled away from the top but otherwise crashes with a "beyond bounds" error.



Any ideas. I am fairly new to this. Thanks.

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails