iphone - Only addSubView in Certain Cells -
i have 10 cells/rows in uitableview , have set 4 of these cells have text so:
if (indexpath.row == 0) { cell.textlabel.text = @"before school"; }
im doing of inside:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {
i struggling add uitextfield specific rows. how can achieve this? have managed add uitextfield either or none of them using:
[cell addsubview:textfield];
hope can help.
you should use if else
statements. example:
if([indexpath row] == 0){ [cell setaccessoryview:textfield]; }else if([indexpath row] == 1){ [cell setaccessoryview:textfield]; }
Comments
Post a Comment