I am trying to add UItableview
on 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. Nothing error
I have faced. I need to build stable 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? I think it will look the same.
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.