Quote:
Originally Posted by humxam
Currently, i am stay at UIView and i want to move UIViewController . I tried:
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
DestinationViewController *controller = [[DestinationViewController alloc] init];
[window setRootViewController: controller];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:destinationViewControll er];
[controller release];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
And I moved to DestinationViewController but there is a problem: all of event (such as : button, label, textfield,... ) was lost !!!!
- If you have other solution to move to UIViewController from UIView, you can guide to me.
P/S: This is urgent. Please help me,
Thanks for all.
|
I'm not sure what you're asking.
I'll guess: You have an app that uses a view directly attached to the window. In the middle of the app, you want to change to a navigation controller/view controller structure.
You might be able to do that, but my advice is, "don't." I've never done it, and would have to set up a sample project and try to get it to work myself in order to guide you on how to do it. I don't have time for that, and suspect nobody else here is going to step up and do that either. Thus, you may be completely on your own if you're determined to make your app work that way.
Restructure your app to make it a navigation app, where the first view controller hides the navigation bar, and uses a simple view. Visually, the effect will be identical. Since your app is now based on a navigation controller, pushing another view controller is trivial.