In my iPhone application I have presented controller:
在我的iPhone应用中,我展示了控制器:
ShareResourceItemViewController* controller = [[ShareResourceItemViewController alloc] initWithSharedResourceItem:[selectedItems objectAtIndex:0]];
[self presentViewController:controller animated:YES completion:nil];
Then in this controller I want to make it transparent on the top. I tried:
在这个控制器中,我想让它在顶部透明。我试着:
-(void)viewDidLoad{
[super viewDidLoad];
[self performSelector:@selector(test) withObject:nil afterDelay:3];
}
-(void)test{
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.opaque = NO;
self.tableView.backgroundView = nil;
}
The background was cleaned but controller is not transparent and I can not see previous controller? How can I fix this?
后台被清理,但控制器不透明,我看不到以前的控制器?我该怎么解决这个问题呢?
3 个解决方案
#1
1
Make the tableview cells background color also to clear color.
使表格视图单元格的背景颜色也要清晰。
#2
1
Try this.
试试这个。
self.view.backgroundColor = [UIColor clearColor];
#3
1
I think that if you want to see your previous View Controller, you want to not present a new view controller, but rather, put a new UIView
on top of your View Controller. View Controllers can't be transparent or not, but views can. Give it a try:
我认为,如果你想看到之前的视图控制器,你不想显示一个新的视图控制器,而是,在你的视图控制器上面放一个新的UIView。视图控制器不能是透明的或不透明的,但是视图可以。试一试:
ShareResourceItemViewController* controller = [[ShareResourceItemViewController alloc] initWithSharedResourceItem:[selectedItems objectAtIndex:0]];
[self.view addSubview:controller.view];
#1
1
Make the tableview cells background color also to clear color.
使表格视图单元格的背景颜色也要清晰。
#2
1
Try this.
试试这个。
self.view.backgroundColor = [UIColor clearColor];
#3
1
I think that if you want to see your previous View Controller, you want to not present a new view controller, but rather, put a new UIView
on top of your View Controller. View Controllers can't be transparent or not, but views can. Give it a try:
我认为,如果你想看到之前的视图控制器,你不想显示一个新的视图控制器,而是,在你的视图控制器上面放一个新的UIView。视图控制器不能是透明的或不透明的,但是视图可以。试一试:
ShareResourceItemViewController* controller = [[ShareResourceItemViewController alloc] initWithSharedResourceItem:[selectedItems objectAtIndex:0]];
[self.view addSubview:controller.view];