iphone - Custom Separator Image disappears in UItableviewcell -
i loading custom separator image in uitableview cell.
here code :
- (uitableviewcell *)tableview:(uitableview *)atableview cellforrowatindexpath: (nsindexpath *)indexpath { static nsstring *cellid=@"cell" mytableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellid]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:switchcellidentifier]; cell.selectionstyle = uitableviewcellselectionstylenone; uiimageview *aswitch = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"divider.png"]]; separator.frame = cgrectmake(0,50,320,1); [cell.contentview addsubview:seperator]; } if(cell.height == 22) { /// here setting frame uiimageview }
but getting seperator image disappears 1 row out of 20 while scrolling.
can please why loading this.
if you've put separator uiimage
out of bounds of cell, , set cell.clipstobounds = no;
have separator image displayed, separator image might hidden drawing next cell.
you can't control z-index of cells they're being drawn on screen, depends you're scrolling (bottom top, or top bottom).
if that's indeed you're issue, can either put divider inside cell's frame, or if separator thin enough use:
[tableview setseparatorcolor:[uicolor colorwithpatternimage:[uiimage imagenamed:...]]];
Comments
Post a Comment