Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何将UITableView设置为透明视图?_Iphone_Uitableview_Opacity_Background Color - Fatal编程技术网

Iphone 如何将UITableView设置为透明视图?

Iphone 如何将UITableView设置为透明视图?,iphone,uitableview,opacity,background-color,Iphone,Uitableview,Opacity,Background Color,在我的应用程序中,我为特定场景的用户提供了一个UITableViewController类(分组样式)。我只想显示表视图的单元格。背景应该是透明的,以便用户可以看到上一页 我在table view控制器的viewDidLoad方法中尝试了以下代码。但是他们没有工作 self.tableView.backgroundColor = [UIColor clearColor]; self.tableView.opaque = NO; self.tableView.backgroundView =

在我的应用程序中,我为特定场景的用户提供了一个UITableViewController类(分组样式)。我只想显示表视图的单元格。背景应该是透明的,以便用户可以看到上一页

我在table view控制器的
viewDidLoad
方法中尝试了以下代码。但是他们没有工作

self.tableView.backgroundColor = [UIColor clearColor];

self.tableView.opaque = NO;

self.tableView.backgroundView = nil;
是否可以显示背景暗淡的单元格


提前感谢

仅仅更改tableView没有帮助。你还得把细胞弄乱。在CellForRowatingIndexPath:(NSIndexPath*)indexPath方法中,将其置于返回语句之前:

UIView * bgView =[[UIView alloc] initWithFrame:CGRectZero] autorelease];
bgView.backgroundColor = [UIColor clearColor];
cell.backgroundView = bgView;
我使用:(在viewDidLoad中)

然后在cellForRowAtIndexPath中:

cell.textLabel.backgroundColor = [UIColor clearColor];
    cell.detailTextLabel.backgroundColor = [UIColor clearColor];
    cell.backgroundColor = [UIColor colorWithWhite:1 alpha:.55];

不确定这是否是你想要的,但它让你可以选择把一切都弄清楚。(很明显,在你的情况下,alpha会发生变化,但这会衡量电池的容量)

你所说的背景变暗是什么意思?浅灰色还是什么?我不明白你在tableview的背景上向用户显示上一页是什么意思!!我想要像[link]()这样的背景,使用你的代码只是隐藏单元格。但是我想减少UITableView背景的不透明度谢谢你的回复。。更改Alpha值将仅影响单元格的背景。我在询问表视图背景的透明度。以模式显示视图/表视图时,行
self.tableView.backgroundColor=[UIColor clearColor]或为
自身设置alpha值。tableView
不起作用:(因此,您希望背景是上一页,比如说50%的alpha,以使其具有“弹出”的效果?如何。代码类似于:UIView*backView=[[UIView alloc]initWithFrame:CGRectZero]autorelease];backView.backgroundColor=[UIColor clearColor];cell.backgroundView=backView;
cell.textLabel.backgroundColor = [UIColor clearColor];
    cell.detailTextLabel.backgroundColor = [UIColor clearColor];
    cell.backgroundColor = [UIColor colorWithWhite:1 alpha:.55];