iphone - Adding NSArray items to UITableViewCell content view -
in app adding 3 uilabel each table view cell in following way.
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"showmorecell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; cell = [self getcellcontentview:cellidentifier]; return cell; } - (uitableviewcell *)getcellcontentview:(nsstring *)cellidentifier { uitableviewcell *cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstylevalue1 reuseidentifier:cellidentifier] autorelease]; cell.backgroundcolor=[uicolor clearcolor]; for(int j = 0; j < 3; j++) [cell insertsubview:[items objectatindex:j] atindex:j]; cell.selectionstyle = uitableviewcellselectionstylenone; return cell; }
here items nsmutablearray
, has got elements of uilabel. trying add 3 labels
in each cell
. displaying 3 labels
in last row.
am doing wrong here ?
thanks
you trying add same uilabel
objects different cells. uiviews
(which uitableviewcell
subclass of) can have 1 parent view. should create 3 new labels every cell (if doesn't contain them yet).
Comments
Post a Comment