VDR5th
VDR5th

Reputation: 1

i want to change the color in my objective c headers. creating a tweak for ios

Hello I'm learning to develop tweaks for ios. I downloaded an opensource tweak and I first wanted to change the colors. I changed them all but one I can't find out how. I want to make the title for headers white and in the center and bigger text

- (NSString *)tableView:(UITableView *)table titleForHeaderInSection:(NSInteger)section {
    switch (section) {
        case 0:
            return @"Border Size";
        case 1:
            return @"Border Color";
        case 2:
            return @"Badge Tint Alpha";
        default:
            return nil;
    }
}

Upvotes: 0

Views: 62

Answers (1)

Shehata Gamal
Shehata Gamal

Reputation: 100503

titleForHeaderInSection can only return a string , you need to implement

 NSArray*arr ;
 NSArray*colors;

In viewDidLoad

arr = [@"Border Size",@"Border Color",@"Badge Tint Alpha"];
colors = [[UIColor redColor],[UIColor blueColor],[UIColor greenColor]];

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 
   UILabel*lbl = [UILabel new];
   lbl.text = arr[section];
   lbl.backgroundColor = colors[section];
   return lbl;
}

Upvotes: 1

Related Questions