What would be the simplest way to convert an existing application with xib files based on UIWindow into a self contained view controller?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Editing post to address comment from OP:
In future apps, you should avoid acting directly upon a UIWindow whenever possible. However, now that you are stuck with an App A that directly acts upon the window, I would suggest that instead of doing a bunch of work to make your app properly use a UIViewController, you can just make App B into an app that uses two windows:
When App B wants to show the content of App A, just instantiate a new UIWindow windowOfAppA, set its rootViewController to the rootViewController of App A, and then call ‘[windowOfAppA makeKeyAndVisible];’. Once App A is done doing it’s work, it can resign key window status by calling ‘[windowOfAppB makeKeyAndVisible];’.
Again, I emphasize that the technique I am grudgingly describing is terrible style and in the future your apps should only use one window it should only act upon it when absolutely necessary. Whenever possible, do all your work through view controllers.
Previous content of this answer: