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