给TableView设置背景图片

来源:互联网 发布:快速掌握java语言 编辑:程序博客网 时间:2024/04/30 13:47

UIImage *image = [UIImage imageNamed:@”1.jpg”];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
// 将图片视图加到视图上
[self addSubview:imageView];
imageView.userInteractionEnabled = YES;
self.myTabelView.alpha = 0.5;
// 将tableView加到图片视图上
[imageView addSubview:self.myTabelView];

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{// 在这个方法里面设置cell的透明度

cell.backgroundColor = [UIColor colorWithRed:123.0 / 255.0 green:23.0 / 255.0 blue:45 / 255.0 alpha:0.1];
return cell;
}

0 0
原创粉丝点击