从iPhone中的弹出窗口导航到另一个窗口

时间:2013-01-31 15:52:03

标签: iphone ios objective-c xcode uipopovercontroller

我使用了这个SampleCode并创建了两个弹出窗口,比如pop-up1和pop-up2。从弹出窗口1如果按下按钮,将显示另一个弹出窗口2。从po-pup2我需要寻找另一种观点。直到弹出2它的罚款,从弹出窗口2我无法单独查看?

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

[self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];
    imageShareSubViewController = nil;

我用过以下代码导航到另一个视图。

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

但上述情况并不正常(即,我可以导航到另一个视图)。怎么解决这个?我错了吗?

1 个答案:

答案 0 :(得分: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];