cam*_*ilo 8 iphone xcode interface-builder uitableview nsstring
一个快速的问题,快速回答(因为我找不到):
有没有办法在iPhone中更改部分标题的字体(由titleForSection给出)?
非常感谢!
cam*_*ilo 39
谢谢Jasarien!你是对的.
我将代码保留在这里以帮助遇到同样问题的人:
- (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;
}
Run Code Online (Sandbox Code Playgroud)
你必须覆盖
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
Run Code Online (Sandbox Code Playgroud)
为节标题提供所需的高度.否则它将与细胞重叠.
| 归档时间: |
|
| 查看次数: |
21170 次 |
| 最近记录: |