开发者

removing window from modalviewcontroller

I launch a modal view controller and in its init I have the following code:

window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
viewController = [[UIViewController alloc]init];
[window addSubview:viewController.view];
[window makeKeyAndVisible];      

I need the viewController for entering some data in it. How can I release the window and viewController so that I can go back to the viewController that launched the modal view controller? At this point, after I'm done doing what I need in the modal view, I am trying:

[viewController.view removeFromSuperview];
[window removeFromSuperview];

but just end up with the modal view's parent (t开发者_运维技巧he one that lanched the modal view) just frozen(it's not really frozen, it is just not user interactible because there are the window and view controller in front of it and the view controller doesn't have size and background


iOS app should only contain one UIWindow. And you can easily present UIViewController with in viewController

[self presentModalViewController:navigationController animated:animated];

Then just call in that viewController to dismiss it:

[self dismissModalViewControllerAnimated:YES];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜