iphone - UIITabelViewCell displaying incorrect images -
hi friends displaying image on table cell table have 10 cell
but displaying images on 2 cell
when scroll table view images come 1 one on cell
so what's doing wrong here.
static nsstring* identifier = @"celltypelabel";
// create custom cell customizedtablecells* cell = nil; if (cell == nil) cell = [[[customizedtablecells alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:identifier] autorelease]; // cell accessory type cell.accessorytype = uitableviewcellaccessorydisclosureindicator; cell.imageview.image = nil; nyhtrappdelegate *appdelegate = (nyhtrappdelegate *)[[uiapplication sharedapplication] delegate]; nsxmlelement* node = [appdelegate.items objectatindex:indexpath.row]; nslog(@"\n output :: %@ :: ", [node xmlstring]); // set lable name cell if(node != null) { int width = cell.contentview.bounds.size.width-50; if([[[node elementforname:@"pubdate"] stringvalue]length] > 0) [cell setcellwithtitleandsize:[[node elementforname:@"title"] stringvalue] rect:cgrectmake(45, 0, width, 35) size: 17]; else [cell setcellwithtitleandsize:@"n/a" rect:cgrectmake(45, 0, width, 35) size: 17]; } nsxmlelement* iconelement = [self geticonelementforthisdomain:[self getdomain:node]]; nsstring* iconimageurl = nil; if (nil != iconelement) iconimageurl = [[iconelement elementforname:@"retina-icon"]stringvalue]; else iconimageurl = @"http://nyhtr.se/icon/nyheter24.png"; // cached images nsstring* imagename = [[uicachedimagemgr defaultmgr] imagenamefromurlstring:iconimageurl]; uiimageproxy* imageproxy = [uicachedimagemgr imagewithname:imagename userinfo:self]; cell.imageview.image = imageproxy.image; return cell;
check following method , add images matching indexpath.row integer value
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { //check indexpath if(indexpath.row==0 || indexpath.row==5){ } else{ //other stuff } }
Comments
Post a Comment