2015-03-11 1 views

Répondre

3

Même manière que vous crée et renvoie les cellules pour les demandes de tableView vous pouvez créer et configurer vue pour tête de section via

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
{ 
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0,0,CGRectGetWidth(tableView.frame), DESIRED_HEADER_HEIGHT)]; 
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithName:@"imageName"]]; 
    imageView.frame = /*set image where you want*/; 
    [headerView addSubview: imageView] 
    return headerView; 
} 

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 
{ 
    return DESIRED_HEADER_HEIGHT; 
} 
0

Vous pouvez remplacer UITableViewDelegate méthode

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

créer un UIImageView avec l'image requise et le retourner.

- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 
    return [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img"]]; 
}