0
我正在嘗試從不顯示用戶登錄看法,如果他在 登錄我在viewWillAppear中隱藏登錄查看,如果用戶登錄
-(void)viewWillAppear:(BOOL)animated
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"userName"]) {
NSDictionary *d = [defaults objectForKey:@"currentUser"];
UserProfile *userData = [[UserProfile alloc]initWithDictionary:d];
[[NetworkModel sharedManager] setCurrentUser:hh];
[self loginResults];
}
self.navigationController.navigationBarHidden = YES;
}
做到這一點,loginResults功能
-(void)childrenReceived:(NSNotification *) notification
{
[SVProgressHUD dismiss];
NSDictionary *userInfo = notification.userInfo;
NSArray *allKids = [userInfo objectForKey:@"children"];
RootViewController *sideBarRoot= [self.storyboard instantiateViewControllerWithIdentifier:@"root"];
sideBarRoot.children = allKids;
[self dismissViewControllerAnimated:YES completion:nil];
[self presentViewController:sideBarRoot animated:YES completion:nil];
}
什麼是問題? – jesse
你想做什麼?請編輯您的問題以提供更多信息並閱讀[如何提問](http://stackoverflow.com/help/how-to-ask)。 –
檢查此:http://stackoverflow.com/questions/41864151/how-to-present-login-screen-only-when-a-userdefaults-key-doesnt-exist/41864888#41864888 – aircraft