1. 程式人生 > >iOS TableView索引字型大小設定

iOS TableView索引字型大小設定

-(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {
    for (UIView *view in [tableView subviews]) {
        if ([view isKindOfClass:[NSClassFromString(@"UITableViewIndex") class]]) {
            // 設定字型大小
            [view setValue:HFont(13) forKey:@"_font"];
            //設定view的大小
            view.bounds = CGRectMake(0, 0, 30, 30);
            //單單設定其中一個是無效的
        }
    }
    
}