有选择地将UITextView添加到UITableView

时间:2011-01-24 04:28:35

标签: iphone objective-c uitableview

如何将UITextField仅添加到只包含一个部分的表中的八个tableview单元格...

3 个答案:

答案 0 :(得分:1)

    if(indexPath.row < 8)
    {
                    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 300.0f, 100.0f)];
                    [[cell contentView] textView];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

实施文件中的方法

答案 1 :(得分:0)

1)你的桌面视图中会有多少个单元格? 2)你需要以任何方式定位吗? 3)你打算用它做什么?

答案 2 :(得分:0)

在'cellForRowatIndexPath'中,只需添加一些'if {} else {}'代码。

如果所有单元格都在一个区域中,则需要使用“[indexPath row]”来区分它们。