【发布时间】:2011-02-02 14:10:10
【问题描述】:
我想在 tableview 上将标题居中,但是我有 2 个问题。首先,我没有正确的高度,其次 UILabel 看起来不像默认标题 - 字体/字体大小/颜色等......有没有更好的方法来居中,和/或有没有办法制作它看起来像默认标题。
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger) section
{
//section text as a label
UILabel *lbl = [[UILabel alloc] init];
lbl.textAlignment = UITextAlignmentCenter;
lbl.text = @"Header";
[lbl setBackgroundColor:[UIColor clearColor]];
return lbl;
}
【问题讨论】:
标签: ios uitableview cocoa-touch