ios - How make background image in tableViewCell -
i have tableview. have problem image in tableviewcell. background color displayed in left , right corner in middle color background tableview. when changed background color in table changed color in middle of tableviewcell...
my cod add image in tableviewcell: when push...
cell.backgroundview = [[[uiimageview alloc] initwithimage:[ [uiimage imagenamed:@"noselected.png"]stretchableimagewithleftcapwidth:0.0 topcapheight:5.0] ]autorelease];
and pushed. pushed displayed okey.
cell.selectedbackgroundview = [ [[uiimageview alloc] initwithimage:[ [uiimage imagenamed:@"yesselected.png"] stretchableimagewithleftcapwidth:0.0 topcapheight:5.0] ]autorelease];
also: tried uicolour clearecolor nothing.
try this...
if want display 1 image each cell.
cell.backgroundview = [[uiimageview alloc]initwithimage:[uiimage imagenamed:@"name_of_the_image_and_no_need_to write_extension"]];
if want display different image different cell
first create image array save images need display in cells..
imgarr = [[nsarray alloc]initwithobjects:[uiimage imagenamed:@"image1"], [uiimage imagenamed:@"image2"], [uiimage imagenamed:@"image3"], nil];
then, in cellforrowatindexpath method
cell.backgroundview = [[uiimageview alloc]initwithimage:[imgarr objectatindex:indexpath.row]];
Comments
Post a Comment