iphone - cellForRowAtIndexPath always return nil -



iphone - cellForRowAtIndexPath always return nil -

i have created sample application insert 12 rows in tableview.and inserted fine.when after inserted rows dont want changes in text during scrolling of tableview.so checked indexpath row has value of uitableviewcell , if has values means homecoming cell otherwise created new uitableviewcell.

my sample code below

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview { homecoming 1;

}

// customize number of rows in table view. - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { nslog(@"globalcount = %d",globalcount); homecoming globalcount;

}

- (uitableviewcell *)tableview:(uitableview *)tv cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *obj = (uitableviewcell*)[tableview cellforrowatindexpath:indexpath]; if(obj!=nil) { nslog(@"cell indexpath row = %d",indexpath.row); nslog(@"cell text = %d",obj.textlabel.text); homecoming obj; } else { nslog(@"obj==nil"); } static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tv dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; cell.selectionstyle = uitableviewcellselectionstylenone; } if([datatable count]>0) cell.textlabel.text = [datatable objectatindex:0]; // configure cell. homecoming cell;

}

what objective , dont want update text (or uitableviewcell)for created indexpath rows(of cell).so can check in cellforrowatindexpath , homecoming nil.if missing ?

i checked using line

uitableviewcell *obj = (uitableviewcell*)[tableview cellforrowatindexpath:indexpath]; if(obj!=nil)

plz help me?

thanks in advance......

let table view decide id need update cell or not. remove firsdt part of code , run smoothly.

don't hesitate read uitableview doc.

iphone cocoa-touch uitableview

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -