关于UItableView的表头背景颜色的设置

来源:互联网 发布:淘宝图片保护怎么申请 编辑:程序博客网 时间:2024/05/16 09:28

在UITableView中,其实有很多的属性,运行的好,我们的应用程序会很流畅和美观,今天在网上找资料,和自己动手写了点小东西,关于UITableView表头的背景颜色和字体颜色的设置。
代码如下:

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{    UIView *myView = [[UIView alloc]init];    [myView setBackgroundColor:[UIColor blueColor]];    UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 0, 120, 44)];    titleLabel.textColor = [UIColor whiteColor];    titleLabel.backgroundColor = [UIColor clearColor];    titleLabel.text = [dateTitle objectAtIndex:section];    [myView addSubview:titleLabel];    return myView;}
0 0