0

我使用了这个SampleCode并创建了两个弹出窗口,比如 pop-up1 和 pop-up2。如果按下按钮,则从弹出窗口 1 中将显示另一个弹出窗口 2。从 po-pup2 我需要去另一个视图。直到 pop-up2 很好,从 pop-up2 我不能去单独的视图?

我使用下面的代码删除了弹出视图。

[self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];
    imageShareSubViewController = nil;

我使用下面的代码导航到另一个视图。

@autoreleasepool {
        ViewController *obj = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]autorelease];
        [self.navigationController pushViewController:obj animated:TRUE];
        obj = nil;
    }

但上述工作不正常(即,我可以导航到另一个视图)。如何解决这个问题?我哪里错了吗?

4

1 回答 1

1

像这样创建你的 navigationController、setRootViewController:

//A view controller:
HomeScreen * homeScreen = [[HomeScreen alloc]initWithNibName:@"HomeScreen" bundle:nil];

UINavigationController* navigation = [[UINavigationController alloc]initWithRootViewController:homeScreen];

AppDelegate * delegate = (AppDelegate*)[[UIApplication sharedAplication]delegate];
delegate.window.rootviewcontroller = navigation;
[homeScreen release];

//add other views

HomeScreen * homeScreen2 = [[HomeScreen alloc]initWithNibName:@"HomeScreen" bundle:nil];

[navigation pushViewController: homeScreen2];
[homeScreen2 release];
于 2013-01-31T16:04:42.347 回答