iPhone模态视图里面的另一个模态视图? [英] iPhone modal view inside another modal view?

查看:96
本文介绍了iPhone模态视图里面的另一个模态视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序在用户添加新foo时使用模态视图。用户使用此模态视图选择foo类型。根据选择的类型,需要向用户询问更多信息。

My App uses a modal view when users add a new foo. The user selects a foo type using this modal view. Depending on what type is selected, the user needs to be asked for more information.

我想使用另一个模态视图来询问这些额外信息。我试图像第一个一样创建新的模态视图(效果很好),并导致Xcode中的堆栈溢出/加载堆栈帧错误。

I'd like to use another modal view to ask for this extra information. I've tried to create the new modal view like the first one (which works great) and it leads to stack overflow/"Loading Stack Frames" error in Xcode.

我是以完全错误的方式解决这个问题,这只是一个非常糟糕的主意吗?我应该重新考虑UI本身吗?

Am I going about this in completely the wrong way i.e. is this just a really bad idea? Should I rethink the UI itself?

UINavigationController *navigationController = [[UINavigationController alloc]   
    initWithRootViewController:addController];
[self presentModalViewController:navigationController animated:YES];


推荐答案

已修复。我通过将第二个视图控制器推送到第一个视图控制器的UINavigationController来获得我想要的行为。

Fixed. I got the behavior I wanted by pushing the second view controller to the first view controller's UINavigationController.

创建第一个模态视图

FooAddController *addController = [FooAddController alloc]
    initWithNibName:@"FooAddController" bundle:nil];
addController.delegate = self;
addController.foo = newFoo;
UINavigationController *navigationController = [[UINavigationController alloc]
    initWithRootViewController:addController];
[self presentModalViewController:navigationController animated:YES];
[addController release];

创建第二模态视图(在FooAddController中)

creation of 2nd modal view (in FooAddController)

FooAddSizeViewController *addSizeController = [[FooAddSizeViewController alloc]
    initWithNibName:@"FooAddSizeViewController" bundle:nil];
addSizeController.delegate = self;
addSizeController.foo = self.foo;
[self.navigationController pushViewController:addSizeController animated:YES];
[addSizeController release];

这篇关于iPhone模态视图里面的另一个模态视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆