2014-02-11 79 views
1

两个问题有关UITableViewiOS版 - UITableView的不同类型的细胞中不同的部分

1)是否有可能为一个UITableView有两个部分,一个动态的细胞类型,另一个与静止细胞类型?

2)当我加入UITableViewController到画布,在Xcode属性编辑器,我不得不选项以指定的细胞类型(动态/静态)。但是当我将UITableView添加到普通的UIView中时,我没有看到这个选项。有任何想法吗?

回答

5

有可能单UITableView使用两节

在这里我把简单的基本逻辑,我希望可能是你已经足够了。 :)
你的UITableView有委托方法名称是cellForRowAtIndexPath,在这种方法中,你可以管理你的部分UITableView,比如放条件。

if(indexPath.section == 0) 
{ 
    // here first section start with 0 
    // and you can also manage row(s) of each section by put condition, such like 

    if(indexPath.row == 0) 
    { 
    // here row 0 means row number 1 of particular section 
    } 
    . 
    . 
    . 

} 
. 
. 
. 

所以,你可以通过section轻松管理您的tableView和row 在你的情况使每个行(S)第一节是动态的,第二部分的每个行(S)是静态的。

相关问题