2009-10-03 38 views
1

所有iphone開發商定製示例的UITableView(分組方式)

我目前正在開發iPhone應用程序,其中我顯示在分組式的分段控制的段中的一個一個UITableView。

我的問題是,我不知道如何在表頭視圖動態顯示的小圖像。

另一個問題是,我不知道如何顯示標籤和按鈕或在特定部分的一個細胞的任何其他控制,也使他們多行。

如果任何一個有代碼或示例,請幫我做這個。

回答

0

它可以通過這個代碼來完成:

GRect newFrame = CGRectMake(0.0, 0.0, self.myDetailView.bounds.size.width, 50.0); 
    UIView *trialHeaderView = [[UIView alloc] initWithFrame:newFrame]; 
    trialHeaderView.backgroundColor = [UIColor clearColor];      

    UIImageView *myImageView = [[UIImageView alloc]initWithFrame:CGRectMake(15, 10, 35, 35)]; 
    myImageView.image = [UIImage imageNamed:@"r1.jpg"]; 
    myImageView.contentMode = UIViewContentModeScaleToFill; 
    [trialHeaderView addSubview:myImageView]; 

myDetailView.tableHeaderView = trialHeaderView; 

確定..

2

這人會,以期取代你的頭,你可以添加任何東西有:

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