setContentOffset only works if animated is set to YES

Posted by Sheehan Alam on Stack Overflow See other posts from Stack Overflow or by Sheehan Alam
Published on 2010-05-26T23:01:23Z Indexed on 2010/05/26 23:21 UTC
Read the original article Hit count: 333

I have a UITableView which I would like to be displayed 100px down. For some reason this only works when animated is set to YES. Why is this?

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    /*[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] 
                          atScrollPosition:UITableViewScrollPositionNone 
                                  animated:NO];*/

    /*[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathWithIndex:1] 
                                        atScrollPosition:UITableViewScrollPositionNone 
                                        animated:NO];*/

    [self.tableView setContentOffset:CGPointMake(0,100) animated:YES];
}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c