2011-02-09 3 views

답변

2

이 UITableViewDelegate 방법을 참조하십시오

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

당신은 IUView 컨테이너에서 이미지보기와 라벨을 넣고 다음 방법 중 하나에서 컨테이너를 반환해야합니다. 그것은 무엇을 어떻게 당신이 그들에게 선물하고 싶어하는지에 달려 있습니다.

0

각 섹션마다 네 개의 별도 테이블이 있고 각 테이블 사이에 imageview와 uilabel을 넣는 사용자 지정보기를 만들어야한다고 생각합니다.

2

테이블 스타일이 입니까?

viewForHeaderInSection: 또는 viewForFooterInSection: 방법을 UITableViewDelegate으로 사용하십시오. 보기를 만들고, 이미지와 레이블을보기에 추가하고 위의 두 가지 대리자 방법 중 하나에서보기로 돌아갑니다. 나는 당신이 섹션의 헤더로 이미지와 레이블을 사용하고있는 것 같아요. 따라서 tableView:viewForHeaderInSection:이 필요합니다.

2

나는 그 방법으로 구현하고 내 필요에 따라 이미지를 보여줍니다. 경로를 보여 주셔서 감사합니다. 다른 사람이 곤경에 처한 경우를 대비하여 코드를 보여줍니다. 감사합니다.

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section 
    { 
      UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0,5,320,40)]; 
      UIImageView *imgAdbar = [[UIImageView alloc]initWithFrame:CGRectMake(header.frame.origin.x,header.frame.origin.y,header.frame.size.width,header.frame.size.height)]; 
      [imgAdbar setImage:[UIImage imageNamed:@"ad2.png"]]; 
      [header addSubview:imgAdbar]; 
      header.backgroundColor = [UIColor clearColor]; 
      return header; 
    } 
관련 문제