gpt4 book ai didi

ios - 呈现后模糊 View Controller 变暗

转载 作者:行者123 更新时间:2023-11-29 02:22:25 27 4
gpt4 key购买 nike

在我这样插入 View Controller 之后:

self.takeoverViewController = [[NoNetworkViewController alloc]initWithNibName:@"NoNetworkViewController" bundle:nil];
self.takeoverViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;

//find topmost VC and put inside a nav controller
UIViewController *topViewController = [self getTopMostViewController];

UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:self.takeoverViewController];

//present the nav controller
[topViewController presentViewController:nav animated:true completion:^{

}];

模糊 View 变暗。也就是说,我看到光线瞬间模糊,然后一切都变暗了。这是我设置模糊 View 的方法。

- (void)viewDidLoad {
[super viewDidLoad];
[self blurBackground];
}

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

//hide nav bar
self.originalNavigationBarState = self.navigationController.navigationBar.hidden;
self.navigationController.navigationBar.hidden = YES;

}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];

//show nav bar
self.navigationController.navigationBar.hidden = self.originalNavigationBarState;
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - UI Utils
- (void)blurBackground {
self.view.backgroundColor = [UIColor clearColor];
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurView = [[UIVisualEffectView alloc]initWithEffect:effect];
blurView.frame = self.view.bounds;
[self.view insertSubview:blurView atIndex:0];
}

最佳答案

- (void)viewDidLoad {
[super viewDidLoad];
}

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self blurBackground];
//hide nav bar
self.originalNavigationBarState = self.navigationController.navigationBar.hidden;
self.navigationController.navigationBar.hidden = YES;

}

移动[ self 模糊背景];在 viewWillAppear 中

关于ios - 呈现后模糊 View Controller 变暗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27976344/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com