开发者

Selectively add UITextView to A UITableView

How do I add a UITextField to only eig开发者_如何学运维ht tableview cells in a table with only one section...


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

to

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

method in your implementation file


1) How many cells is going to be in your tableview? 2) Do you need to position it in any way? 3) What do you intend to do with it?


Insid of 'cellForRow:atIndexPath', just add some 'if{}else{}' code.

If all of your cells are in one section, you want to use '[indexPath row]' to differentiate between them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜