开发者

iphone grouped uitableview header font style

I'm having trouble changing the section header for my grouped uitableview. I have tried everything. I have wondered whether it is a bug with the simulator or something? I am running the latest version of xcode and am developing for the iPad.

Here's my tableview header code

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    UILabel *label = [[[UILabel alloc] init] autorelease];
    label.frame = CGRectMake(20, 6, 300, 30);
    label.backgroundColor = [UIColor clearColor];
    label.textColor = [UIColor whiteColor];
    label.shadowColor = [UIColor grayColor];
    label.shadowOffset = CGSizeMake(0.0, 1.0);
    label.font = [UIFont boldSystemFontOfSize:14];
    label.text = @"hello"; //sectionHeader;

    return label;

}

When I compile, it simply displays with NO headings. 开发者_Python百科I've also tried to add a view here too, as per the code below

UIView *sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
sectionView.backgroundColor = [UIColor redColor];
[sectionView autorelease];
[sectionView addSubview:label];
return sectionView;

Am I doing something wrong?


From the documentation:

[tableView:viewForHeaderInSection:] only works correctly when tableView:heightForHeaderInSection: is also implemented.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜