[英]Add UItableview on UIVisualEffectView using Objective C
我試圖在UItableview
上添加UIVisualEffectView
。 我的編碼如下
// 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];
每當我scrolling tableview
UIVisualEffectView
隱藏起來。 我沒有遇到任何error
。 我需要構建穩定的UIVisualEffectView
。
嘗試這個
刪除此行
[self.view addSubview:visualEffectView];
並在這里添加
[visualEffectView.contentView addSubview: table];
[self.view addSubview:visualEffectView];
為什么不在effectView上方添加UITableView並設置tableView的背景色為透明色? 我認為它會看起來一樣。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.