iphone - uitableviewcell background -
i have uitableview (grouped style). wanted customize appears "stick it" or "post it" yellow background interface.
hence added following code
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uiview *backgroundview = [[[uiview alloc] initwithframe:cgrectzero] autorelease]; backgroundview.backgroundcolor = [uicolor yellowcolor]; cell.backgroundview = backgroundview; cell.textlabel.backgroundcolor=[uicolor yellowcolor]; }
this worked. able achieve yellow background, separator line missing. can some1 me out ?
is best way it? or should create image cell , use backgroundview?
outdated.
why creating custom background view? if want achieve yellow color can customize color using uicolor colorwithred: green: blue: alpha:
create own color , add cell setbackgroundcolor:uicolor
. seems seperator being overwritten if add background view in grouped table view. if still want have custom uiview background, suggest adding custom tableviewcell looks seperator. can regulate in cellforrowatindexpath
.
working code first suggestion:
[cell setbackgroundcolor:[uicolor yellowcolor]];
Comments
Post a Comment