本文共 1220 字,大约阅读时间需要 4 分钟。
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
-
-
-
- UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 20.0)];
-
- UIImageView *bg = [[UIImageView alloc]initWithFrame:customView.frame];
-
- bg.image = [UIImage imageNamed:@"carTypeCellTitleBg1.png"];
-
-
- [customView addSubview:bg];
-
-
- UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
-
- headerLabel.backgroundColor = [UIColor clearColor];
-
- headerLabel.opaque = NO;
- headerLabel.textColor = [UIColor colorWithRed:242.0/255.0f green:161.0/255.0f blue:4.0/255.0 alpha:1.0];
-
-
-
- headerLabel.font = [UIFont italicSystemFontOfSize:15];
- headerLabel.frame = customView.frame;
-
-
-
-
-
-
-
- headerLabel.text = @"title";
-
- [customView addSubview:headerLabel];
-
- return customView;
-
- }
-
- - (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- return 21.0;
- }
转载地址:http://guvsi.baihongyu.com/