[英]Add UItableview on UIVisualEffectView using Objective C
I am trying to add UItableview
on UIVisualEffectView
. 我试图在
UItableview
上添加UIVisualEffectView
。 I have coded like below 我的编码如下
// MainView
Mainview = [[UIView alloc] init];
[self.view addSubview:Mainview];
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
[visualEffectView setFrame:self.view.bounds];
[self.view addSubview:visualEffectView];
table = [[UITableView alloc]init];
table.scrollEnabled = YES;
table.allowsSelection = YES;
table.dataSource = self;
table.delegate = self;
table.showsVerticalScrollIndicator = YES;
table.userInteractionEnabled = YES;
table.bounces = YES;
[table setBackgroundView:nil];
[table setOpaque:NO];
[table setContentInset:UIEdgeInsetsMake(1.0, 0.0, 0.0, 0.0)];
[table setContentOffset:CGPointMake(0,500) animated:YES];
[visualEffectView.contentView addSubview: table];
Whenever I am scrolling tableview
suddenly UIVisualEffectView
hiding. 每当我
scrolling tableview
UIVisualEffectView
隐藏起来。 Nothing error
I have faced. 我没有遇到任何
error
。 I need to build stable UIVisualEffectView
. 我需要构建稳定的
UIVisualEffectView
。
try this 尝试这个
remove this line 删除此行
[self.view addSubview:visualEffectView];
and add here 并在这里添加
[visualEffectView.contentView addSubview: table];
[self.view addSubview:visualEffectView];
Why not add the UITableView above the effectView and set the background color of tableView clear color? 为什么不在effectView上方添加UITableView并设置tableView的背景色为透明色? I think it will look the same.
我认为它会看起来一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.