Her*_*doZ 4 storyboard ios ios6
在我的app委托中,如果保存了用户详细信息,我将用户推送到视图控制器
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
// cached user
PFUser *currentUser = [PFUser currentUser];
if (currentUser)
{
NSLog(@"current user signing and looking for VC %@", currentUser);
// A user was cached, so skip straight to the main view
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
TaskSelectionViewController*viewController = [[TaskSelectionViewController alloc] initWithUser:currentUser];
[navigationController pushViewController:viewController animated:YES];
NSLog(@"VC found");
} else {
NSLog(@"VC not found");
}
Run Code Online (Sandbox Code Playgroud)
TaskSelectionViewController.m
-(id)initWithUser:(PFUser *)currentUser
{
NSLog(@"current user %@", currentUser);
NSLog(@"task Selection initwithuser");
return self;
}
Run Code Online (Sandbox Code Playgroud)
推送工作正常,但我得到的是顶部的NavigationController栏和黑色屏幕.
缺什么 ??
谢谢你的帮助.
Her*_*doZ 24
使用instantiateViewControllerWithIdentifier完成:@"ID"
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
TaskSelectionViewController *controller = (TaskSelectionViewController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"task"];
[navigationController pushViewController:controller animated:YES];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17186 次 |
| 最近记录: |