Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
467 views
in Technique[技术] by (71.8m points)

user interface - iPhone modal view inside another modal view?

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.

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.

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];
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

creation of 1st modal view

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];

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];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...