iphone - Customized UITableViewCell dissappears -
i've seen number of people having similar issue, either solution did not help, or different.
my problem is, have customized uitableviewcell, custom size, image , content. when scroll or down , again, text within of cells disappears. seems happening randomly.
i have read "dequeue"-issue either got wrong or doesnt fall case....
anyways, heres code cells:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; } cell.selectionstyle = uitableviewcellselectionstylenone; cell.imageview.image = [[uiimage alloc] initwithcontentsoffile: [[nsbundle mainbundle] pathforresource: [[shopitems objectatindex:indexpath.row] name] oftype:@"jpg"]]; uitextfield *temp= [[uitextfield alloc] initwithframe:cell.frame]; temp.text = [[shopitems objectatindex:indexpath.row] name]; temp.textcolor = [uicolor whitecolor]; temp.textalignment = uitextalignmentcenter; uiimageview *cellview = [[uiimageview alloc] initwithimage:[[uiimage alloc] initwithcontentsoffile: [[nsbundle mainbundle] pathforresource:@"smalltabs_wide_bg" oftype:@"png"]]]; [cellview addsubview:temp]; cell.backgroundview = cellview; return cell; }
do have any(!) ideas on this?
use reusablecell method
read discussion
http://discussions.apple.com/thread.jspa?threadid=2075838&tstart=1035
Comments
Post a Comment