Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-20-2011, 09:25 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 9
humxam is on a distinguished road
Default How to get UIViewController from UIView ?

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.
humxam is offline   Reply With Quote
Old 10-20-2011, 09:43 PM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by humxam View Post
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.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 10-20-2011, 10:59 PM   #3 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 113
jonusx is on a distinguished road
Default

I have to agree. Its impossible to "turn" a uiview into a viewcontroller. Look into apples view controller programming guide
__________________
What do you have to share? Share and view pics Oneshare

Play Magic: The Gathering? Try The Sylvan Archives!

Warhammer 40k your thing? W40k Manager is your thing.

Like karaoke? Try iSing Karaoke Locator
jonusx is offline   Reply With Quote
Reply

Bookmarks

Tags
delegate, iphone, solution, uiview, uiviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 397
14 members and 383 guests
13dario13, 7twenty7, buggen, EvilElf, glenn_sayers, j.b.rajesh@gmail.com, LunarMoon, morterbaher, n00b, QuantumDoja, sacha1996, Sami Gh, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,673
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, morterbaher
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:27 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0