简体   繁体   中英

iphone:how to set table background Image

I tried that as 1st took image view as background of table view and select the image.then i perform the following code in view will appear:

  table.backgroundColor = [UIColor clearColor];

and also clear the custom cell label.but it overlaps the table values.

This works for me

UIImageView *tempImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
[tempImg setImage:[UIImage imageNamed:@"IMG_0071.JPG"]];
[testTableView setBackgroundView:tempImg];

you need to use transparent UITableView on the UIImageView. Put your image into the image view and it looks like table's background image as you want

you might wanna try putting UIImage behind UITableView.. Use method insertView:atIndex: on a view.

also.. you might wanna look at this tutorial by Matt Gallagher http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html

You have to clear tableviewcell background color. You have to write this code before return cell; statement.

cell.backgroundColor = [UIColor clearColor];

And also table cell label color.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM