Custom UITableView section index

后端 未结 9 713
暗喜
暗喜 2020-11-27 14:54

Is it possible to customize the UITableView\'s section index? I mean, changing the font style/size, background (which is semitransparent by default) etc. I\'m guessing that

相关标签:
9条回答
  • 2020-11-27 15:44

    https://github.com/Hyabusa/CMIndexBar

    Use this plugin from Hyabusa. Simple replacment for UITableView Index that allows setting of colors

    CMIndexBar *indexBar = [[CMIndexBar alloc] initWithFrame:CGRectMake(self.view.frame.size.width-35, 10.0, 28.0, self.view.frame.size.height-20)];
    [indexBar setIndexes:[NSMutableArray arrayWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G", nil]];
    [self.view addSubview:indexBar];
    [indexBar release];
    

    Delegate

    - (void)indexSelectionDidChange:(CMIndexBar *)IndexBar:(int)index:(NSString*)title;
    
    0 讨论(0)
  • 2020-11-27 15:45
    self.tableView.sectionIndexColor = [UIColor brownColor];
    self.tableView.sectionIndexBackgroundColor = [UIColor clearColor];
    self.tableView.sectionIndexTrackingBackgroundColor = [UIColor blueColor];
    
    0 讨论(0)
  • 2020-11-27 15:47

    I ended up using a custom view. It's not possible to customize the table index.

    0 讨论(0)
提交回复
热议问题