tags:

views:

118

answers:

1

Hi, I have a UITableView that I build up programmatically and want to preselect a certain section header at startup.

Any hints how I can achieve that?

+1  A: 

I'm not quite sure what you mean by pre-select a section header. If you're looking to ensure that the section you are interested in is visible when your app starts you can use this method on UITableView:

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath
              atScrollPosition:(UITableViewScrollPosition)scrollPosition 
                      animated:(BOOL)animated

If you want to select a row in a particular section you could use this method (which will also scroll to the selected row):

- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath 
                    animated:(BOOL)animated 
              scrollPosition:(UITableViewScrollPosition)scrollPosition
smountcastle