2011-02-09 30 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

我以這種方式實現的,它顯示了按我的need.Thank圖像您顯示的路徑,我顯示的情況下別人是need.Thank你的代碼。

-(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; 
    } 
相關問題