一个简单的问题,一个快速的答案(因为我没有找到任何答案):
有没有办法在 iPhone 中更改该部分标题的字体(由 titleForSection 给出)?
非常感谢!
最佳答案
谢谢贾萨里恩!你说得完全正确。
我在这里留下我的代码来帮助遇到同样问题的人:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *sectionTitle = @"Just a title";
// Create label with section title
UILabel *label = [[[UILabel alloc] init] autorelease];
label.frame = CGRectMake(0, 0, 284, 23);
label.textColor = [UIColor blackColor];
label.font = [UIFont fontWithName:@"Helvetica" size:14];
label.text = sectionTitle;
label.backgroundColor = [UIColor clearColor];
// Create header view and add label as a subview
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
[view autorelease];
[view addSubview:label];
return view;
}
关于iphone - UITableView titleForSection 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2450861/