I have the following code to set my cell's background as an image:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 150, 55)];
imageView.image = [UIImage imageNamed:@"cellBackground.png"];
cell.backgroundView = imageView;
but unfortunately the background image is cut to half, IDK why:
Thanks.
如果您使用默认的UITableViewCell,那么这应该可以解决您的问题:
cell.textLabel.backgroundColor = [UIColor clearColor];
You can also try like this ;
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 150, 55)];
imageView.image = [UIImage imageNamed:@"cellBackground.png"];
cell.contentView.addSubView = imageView;
Or you can also try this ;
YourTableView.setBackgroundColor = [UIColor clearColor];
Hope this will help
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.