- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView* headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 100)];
headerView.backgroundColor = [UIColor colorWithWhite:0.5f alpha:1.0f];
headerView.layer.borderColor = [UIColor colorWithWhite:1.0 alpha:1.0].CGColor;
headerView.layer.borderWidth = 1.0;
UILabel* headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(5,headerView.frame.size.height-40, tableView.frame.size.width - 5, 30)];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.textColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:22.0];
headerLabel.text = @"yourText";
headerLabel.textAlignment = NSTextAlignmentLeft;
UIImageView *headerImage = [[UIImageView alloc]initWithFrame:headerView.frame];
headerImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"image.jpg"]];
headerImage.contentMode = UIViewContentModeScaleAspectFill;
[headerImage setClipsToBounds:YES];
[headerView addSubview:headerImage];
[headerView addSubview:headerLabel];
return headerView;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 100;
}