0

我有一个应用程序,其中有 LoginView 我正在这样做,如果用户第一次在应用程序中输入它会向他显示登录屏幕它工作正常,但问题是当登录屏幕在此之前出现时,眨眼间你会看到主屏幕拆分视图控制器。

这是我的代码

   if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) {

     [self.window addSubview:[splitViewController view]];
      LoginViewController *targetController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
    targetController.modalPresentationStyle = UIModalPresentationFullScreen;
     [self.splitViewController presentViewController:targetController animated:YES completion:nil];
     }

 else {

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

    NSString*userNameM=[defaults objectForKey:@"userName"];
    NSString*userIDM=[defaults objectForKey:@"userID"];

    NSString*organizationCodeM=[defaults objectForKey:@"organizationCode"];

    userName=userNameM;
    userID=userIDM;

    organizationCode=organizationCodeM;

    [self.window addSubview:[splitViewController view]];
   }
4

0 回答 0