我想在呈现 ( ) 时模糊我的UITableView
( 内部) 但是在使用时它不会模糊它后面的表格视图的内容;它只是阻止它。发生在模拟器和设备上。UITableViewController
UIAlertController
UIAlertControllerStyleActionSheet
UIBlurEffect
UIVisualEffectView
- (void)showAlert {
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
visualEffectView.frame = CGRectMake(0, self.tableView.contentOffset.y, self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:visualEffectView];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Alert Title" message:@"Alert Message" preferredStyle:UIAlertControllerStyleActionSheet];
[alert addAction:[UIAlertAction actionWithTitle:@"Action 1" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
// handle choice...
[visualEffectView removeFromSuperview];
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"Action 2" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
// handle choice...
[visualEffectView removeFromSuperview];
}]];
[self presentViewController:alert animated:YES completion:nil];
}
截屏:
操作表后面的表格视图中有文本内容应该显示为模糊,例如,如下图所示: