iphone - Adding UIImageView or UIView to the cell of the grouped table -
i having problem setting uiimageview or uiview on cell of grouped table on iphone.
for using code
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *simpletableidentifier = @"simpletableidentifier"; nsarray *listdata =[self.tablecontents objectforkey:[self.sotrekeys objectatindex:[indexpath section]]]; uitableviewcell * cell = [tableview dequeuereusablecellwithidentifier:simpletableidentifier]; if(cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:simpletableidentifier] autorelease]; } if(indexpath.section == 1 && indexpath.row ==1) { uiimageview *imageview = [[uiimageview alloc] initwithframe:cgrectmake(240, 14, 40, 40)]; imageview.image = [uiimage imagenamed:[nsstring stringwithformat:@"back.png",nil]]; [cell.contentview addsubview:imageview]; [imageview release]; } nsuinteger row = [indexpath row]; cell.textlabel.text = [listdata objectatindex:row]; return cell; [tableview deselectrowatindexpath:indexpath animated:yes]; }
but not placed on cell . when ever select row display time only, problem?
does have idea problem is. think image getting overwritten cell .
thanks in advance
try making
cell.accessorytype = uitableviewcellaccessorynone;
it seems adding image on accessory view.
if yes, can add cell.accessoryview = imageview;
Comments
Post a Comment