开发者

Iphone tableView index position/setting

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


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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜