我有一个iOS应用程序,它具有独特的屏幕呈现关系。
现在我已经在每个屏幕的viewDidLoad
内写了一些条件,以便能够在需要时跳过它们。
如果符合条件,屏幕应该在不显示其视图的情况下被解除,并且下一个屏幕会被加载。
会发生什么:
然而,前一个屏幕的视图在屏幕上闪烁一秒钟 我怎么能防止这种眨眼?
这是我被解雇的屏幕的条件
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if(self.isEditingDetails){
[self setUserDetails:[self.userSettings getUserDetails]];
}
User *user = [self.userSettings getUserDetails];
BOOL isRegistered = [user isRegistered];
if(isRegistered || !_editingDetails){
[[NSNotificationCenter defaultCenter] postNotificationWithName:kNotificationShowMainScreen andObject:nil];
[self dismissViewControllerAnimated:NO completion:NULL];
return;
}
}
这是新屏幕的展示
if([[note name]isEqualToString:kNotificationShowMainScreen]){
MainPageControllerViewController *mainScreen = (MainPageControllerViewController *)[_window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"MainPagerControllerViewController"];
[_window.rootViewController presentViewController:mainScreen animated:YES completion:^{
self.window.rootViewController = mainScreen;
}];
}