views:

21

answers:

1

Hi all,

Sorry if I missed anything about this but I have a table view with 2 large sections and an index to navigate between sections:

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
    NSMutableArray *listArray = [[NSMutableArray alloc] init];
    listArray = [NSArray arrayWithArray:[@"S|H"componentsSeparatedByString:@"|"]];
    return listArray;}

Since I only have 2 sections the top index "S" is at the top and "H" is at the extreme bottom of the screen.

Is there any way to reposition those two index letters to be located at the center? (or at least near each other)

Thanks

+1  A: 

I don't think so - positioning the labels is really up to the OS, and finally it meets user expectation.

Your code leaks an NSMutableArray though, as you first alloc/init an array, and then reassign the variable to another array.

Also, arrayWithArray: is overkill here.

Make it

NSArray *listArray = [@"S|H"componentsSeparatedByString:@"|"];

or better yet

NSArray *listArray = [NSArray arrayWithObjects:@"S", @"H", nil];
Eiko
Ahh didn't catch that leak thanks.
Kevin