views:

69

answers:

2

Hi,

i have coded following in appDelegeate .m file .but i cant run presentModalViewController method.if i run [self.window addSubview:mview] ,it does not show the result..?any help to go from one controller to another controller?here mtController is Navigationcontroller.

- (void)flip
{
    MViewController *mview = [[MViewController alloc] init]; 
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft 
                           forView:window
                             cache:YES];
    [mtController.view removeFromSuperview];
    [self.window addSubview:mview];
   // [self presentModalViewController:mailView animated:YES];
    [UIView commitAnimations];  
    [mailView release]
}
A: 

If you want to add a NavigationController to a window you are supposed to call
[self.window addSubview:mview.view];
And if you want to go from one view in a NavigationController to another view, the correct thing to do would be to push the new ViewController.
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated

phunehehe
A: 

In your code sample you create an object called mview, but then below in the presentModalViewController you reference mailView (and in the release). Is that a mistake?

After you add the mview.view to the window, is it the only view on the stack? If not, you might need to bring it to the front. Also, assuming the release statement at the bottom was meant to be [mview release] you're going to have another problem if you don't save/retain that view controller. I don't believe adding it to the window subviews retains it.

Brian Yarger