views:

141

answers:

1

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];
}
A: 

Using the base Navigation-based Application that XCode supplies and giving it some table cells, it works fine with what you've given. Have you tried setting the content offset within viewDidAppear rather than viewWillAppear?

David Liu
no luck in viewDidAppear either.
Sheehan Alam
How is this view being presented? Is this view just directly shown as it's loaded? Is it being animated in? Also, is this a view within another view? Etc.
David Liu
It's being animated in. this is not a view within another view.
Sheehan Alam