appdelegate comment pushViewController avec storyboard
Dans mon application délégué je suis poussant l'utilisateur à un view controller si les détails de l'utilisateur sont enregistrées
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");
}
TaskSelectionViewController.m
-(id)initWithUser:(PFUser *)currentUser
{
NSLog(@"current user %@", currentUser);
NSLog(@"task Selection initwithuser");
return self;
}
Le push est un travail, mais tout ce que j'obtiens est le NavigationController barre en haut et un Écran noir.
ce qui est absent ??
merci pour votre aide.
OriginalL'auteur HernandoZ | 2013-01-04
Vous devez vous connecter pour publier un commentaire.
OK fait en utilisant instantiateViewControllerWithIdentifier:@"ID"
merci c'est génial de travailler!
Génial. Je n'étais pas à l'aide de la table de montage séquentiel. UINavigationController *navigationController = (UINavigationController *)auto.de la fenêtre.rootViewController; TaskSelectionViewController *controller = [[TaskSelectionViewController alloc] init]; [navigationController pushViewController:contrôleur de animated:YES];
OriginalL'auteur HernandoZ
Dans le
-(id)initWithUser:(PFUser *)currentUser
de TaskSelectionViewController vous devriez appeler[super init]
ou quelque chose de similaire à votre ViewController initialisé correctement. Cela a résolu un problème similaire, du moins pour moi.Regardez Apple exemples pour les implémentations de méthodes d'initialisation de vue des contrôleurs.
OriginalL'auteur LifeIsHealthy