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 08-16-2010, 04:10 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 89
jkhamler is on a distinguished road
Default NOOB Question - Changing Views

I'm making a view based app and I'm currently using this code to change views, which works but it's messy and leaks memory.

-(IBAction)gotoLoginView: (id)sender{

LoginViewController *loginView = [[LoginViewController alloc]
initWithNibName:@"LoginViewController" bundle:nil];
[self.view addSubview:loginView.view];
}

I know I don't need to create an instance of the view controller but I don't know how else to create a reference to the view needed.

Help greatly appreciated!

Jon
jkhamler is offline   Reply With Quote
Old 08-16-2010, 04:13 PM   #2 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Alaska
Posts: 63
mriphoneman is on a distinguished road
Default

Create a new project using the "Utility" template. This will give you 2 view controllers. One will be your MainViewController, and the other one will be your FlipsideViewController. Just use that code, and you'll be good.
mriphoneman is offline   Reply With Quote
Old 08-16-2010, 04:23 PM   #3 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 11
primedime is on a distinguished road
Default

mriphoneman... what if you have an app that you want to connect more then two views? do you just repeat the same code over again? I am having trouble being able to use more then two views in an application...
primedime is offline   Reply With Quote
Old 08-16-2010, 04:32 PM   #4 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 89
jkhamler is on a distinguished road
Default

I've got loads of views too.
jkhamler is offline   Reply With Quote
Reply

Bookmarks

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: 355
4 members and 351 guests
givensur, linkmx, Newbie123, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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