2010-06-22 3 views
0

J'ai été bloqué à ce problème pendant un certain temps maintenant. J'ai un UIVIEW (SelectionScreen) qui a été poussé en utilisantNavigationBar PushViewController ne fonctionne pas

SelectionScreen *aSelectionScreenViewController =[[SelectionScreen alloc]initWithNibName:@"SelectionScreen" bundle:nil]; 
self.navigationController pushViewController:aSelectionScreenViewController animated:YES] 

[aSelectionScreenViewController release]; 

Cela fonctionne bien. Mais maintenant le problème vient avec cette classe. Cette classe contient en réalité une autre classe appelée SelectionScreenTable. Ainsi, l'architecture serait comme ce SelectionScreen -SelectionScreenTable

Alors maintenant dans la méthode didSelectRow du fichier SelectionScreenTable.m i essayé de pousser une autre classe (classe est appelée Graph.h), mais sa ne fonctionne pas, le code i l'utilisation est exactement la même que ci-dessus.

J'ai donc essayé de pousser Graph au tout début du mainFlow de l'application, juste pour voir si mon code fonctionne ou mal, et oui, son fonctionnement.

Alors je me demandais, comment puis-je résoudre ce problème? Détecter la superclasse et ensuite pousser la vue dans la vue d'ensemble? IM A OBJ-C newb cependant, les codes et les exemples seraient bien. Toute idée les gars? Merci d'avoir lu btw

+0

Le problème provient-il de mon écran de sélection? SelectionScreen contient le SelectionScreenTable en l'ajoutant en tant que sous-vue. C'est ainsi que j'ai fait en sorte que mon Ecran SelectionScreen "conserve" le SelectionScreenTable – Kenneth

+0

SelectionScreen.m SelectionScreenTable * aSelectionScreenTableViewController = [[SelectionScreenTable alloc] initWithNibName @ "sélectionSélectionnable" bundle: nil]; aSelectionScreenTableViewController.view.bounds = CGRectMake (0,0,896,613); aSelectionScreenTableViewController.view.center = CGPointMake (576,380); [self.view addSubview: aSelectionScreenTableViewController.view]; – Kenneth

Répondre

0

Je l'ai résolu en utilisant une animation de transition à la place. .

GraphView *viewController =[[GraphView alloc]initWithNibName:@"GraphView" bundle:nil]; 
    viewController.view.transform = CGAffineTransformMakeRotation(-3.14 *(0)/180.0); 
    viewController.view.bounds = CGRectMake(0,0,1025,769); 
    viewController.view.center = CGPointMake(512.5, 374.5); 

    UIView *theCurrentView = self.view; 
    UIView *theWindow = [theCurrentView superview]; 
    [theCurrentView removeFromSuperview]; 
    [theWindow addSubview:viewController.view]; 

    CATransition *animation = [CATransition animation]; 
    [animation setDuration:0.35]; 
    [animation setType: kCATransitionPush]; 
    [animation setSubtype:kCATransitionFromTop]; 
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]]; 
    [[theWindow layer] addAnimation:animation forKey:@"SwitchToGraphView"]; 
    [viewController release];