I want to put some background image for TableView row cell. I am using the following code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
.....................
...................
UIImage * backgroundImage = [UIImage imageNamed:@"cell.png"]; UIColor *backgroundColor = [[UIColor alloc] initWithPatternImage:backgroundImage];
cell.opaque = NO;
cell.contentView.opaque = NO;
cell.backgroundColor = [UIColor clearColor];
cell.backgroundColor = backgroundColor;
//cell.contentView.backgroundColor = [UIColor clearColor];
//cell.contentView.backgroundColor = backgroundColor;
}
But it is not giving the background image properly. Could someone guide me what is the proper ways of setting background image for a tableview row? Note: I'm also setting background image for my TableView as well using the below code:
UIImage * backgroundImage = [UIImage imageNamed:@"Tablebackground.png"];
UIColor *backgroundColor = [[UIColor alloc] initWithPatternImage:backgroundImage];
self.myTableView.backgroundColor = [UIColor clearColor];
self.myTableView.alpha = 0.9;
self.myTableView.backgroundColor = backgroundColor;
I don't observe any problem for tableview background. Only thing here is, tableview background image is not being static, when scrolling happening, image is also scrolling.
But i want to know first how to set background image for Tableview row cell?
Thank you.
这是迄今为止我阅读过的有关UITableView定制的最佳教程: http : //cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html
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.