Only addSubView in Certain Cells

I have 10 cells/rows in a UITableView and I have set four of these cells to have some text like so:

if (indexPath.row == 0) {
        cell.textLabel.text = @"Before School";

Im doing all of this inside:

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

I am struggling to add a UITextField to only specific rows. How can I achieve this? I have managed to add a UITextField to either all or none of them using:

[cell addSubview:textField];

Hope you can help.


You should use if else statements. For example:

if([indexPath row] == 0){
  [cell setAccessoryView:textField];
}else if([indexPath row] == 1){
  [cell setAccessoryView:textField];

Need Your Help

What is the normal way to create a unique ID for POP3 emails?

php email hash uniqueidentifier pop3

IMAP messages have a UID for which we all rejoice. However, I'm trying to figure out how to generate a unique ID for a POP3 message and having trouble (old systems like only allow POP3)...

How to remove all options from a Dijit FilteringSelect widget?

javascript widget dojo dijit.form

I tried removing all options from dijit.form.filteringselect and adding an option to dijit.form.filteringselect using the below function. However, I am getting an error: no method getOptions and