我想更改objective c标题中的颜色。为ios创建调整
你好,我正在学习为ios开发调整。我下载了一个开源的调整,我首先想改变颜色。我把它们都改了,只有一个我不知道怎么改的。我想使标题为白色,在中心和更大的文本我想更改objective c标题中的颜色。为ios创建调整,ios,objective-c,Ios,Objective C,你好,我正在学习为ios开发调整。我下载了一个开源的调整,我首先想改变颜色。我把它们都改了,只有一个我不知道怎么改的。我想使标题为白色,在中心和更大的文本 - (NSString *)tableView:(UITableView *)table titleForHeaderInSection:(NSInteger)section { switch (section) { case 0: return @"Border Size";
- (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;
}
}
titleForHeaderInSection
只能返回字符串,需要实现
NSArray*arr ;
NSArray*colors;
在
viewDidLoad
arr = [@"Border Size",@"Border Color",@"Badge Tint Alpha"];
colors = [[UIColor redColor],[UIColor blueColor],[UIColor greenColor]];
我对这一点非常陌生,如何实现NSArrayarr;还有五颜六色;?在头文件中将arr和colors声明为NSArray。然后将这两行放在viewDidLoad中。
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UILabel*lbl = [UILabel new];
lbl.text = arr[section];
lbl.backgroundColor = colors[section];
return lbl;
}