Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
474 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...