Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 20, 2010, 08:39 PM   #1
tommyh1122
macrumors newbie
 
Join Date: May 2008
How to specify a view .xib file

I am hoping someone can help me. I am new to iPhone development and have a problem that is probably pretty simple.

If you have a .xib file with two views how do you specify a view to load? From the main screen I have two buttons one is to call one view the other to call the other view from the .xib file. When I make the call it is loading the view that is connected with the Files's Owner view.

Code:
- (IBAction)switchLFamilies:(id)sender
{
	SecondSwapeViewController *familiesL = [[SecondSwapeViewController alloc] initWithNibName:nil bundle:nil];
	familiesL.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
	[self presentModalViewController:familiesL animated:YES];

}
Any help would be appreciated...Thank you..
Attached Thumbnails
Click image for larger version

Name:	Screen shot 2010-05-20 at 9.35.34 PM.png
Views:	7
Size:	36.7 KB
ID:	227011  
tommyh1122 is offline   0 Reply With Quote
Old May 20, 2010, 10:12 PM   #2
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
When your view controller is presented it obviously shows the view that is set as its view property. If you want to show another view then you need to have an outlet for the other view and then set the view controller's self.view to the other view.

Last edited by PhoneyDeveloper; May 21, 2010 at 08:53 AM.
PhoneyDeveloper is offline   0 Reply With Quote
Old May 21, 2010, 04:44 AM   #3
tommyh1122
Thread Starter
macrumors newbie
 
Join Date: May 2008
I do have an outlet for each of the view's (portrait, landscape) but this not being called from the SecondSwapeViewController.m, it is being called from SwapeViewController.m.
Attached Images
 
tommyh1122 is offline   0 Reply With Quote
Old May 21, 2010, 08:59 AM   #4
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Add a method to your view controller that has two views. This method will save a BOOL that tells it which view should be shown and set self.view = whateverView. Also add code that sets the correct view based on this BOOL in the view controller's viewDidLoad. After you alloc/init the view controller call this method.


Code:
	SecondSwapeViewController *familiesL = [[SecondSwapeViewController alloc] initWithNibName:nil bundle:nil];
	familiesL.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        [familiesL showView2:YES];
	[self presentModalViewController:familiesL animated:YES];
PhoneyDeveloper is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Tutorial: How to get PCSX2 to run on Mac (without BootCamp) Mirrors Mac Applications and Mac App Store 22 Jun 14, 2013 08:19 PM
IPHONE 4 how to JAILBREAK AND UNLOCK bs2511feist Jailbreaks and iOS Hacks 6 Apr 14, 2012 05:52 PM
How to convinc my parents to let me buy a 17" MacBook pro Ulf1103 Buying Tips and Advice 55 Feb 20, 2012 08:11 AM
Does anybody know how to get TweetTask? xmelissaxmayhem Jailbreaks and iOS Hacks 3 Jul 3, 2011 01:21 AM
[HOW TO] DIY iPhone 4 Swivel Car Mount QuarterSwede iPhone Accessories 13 Mar 8, 2011 02:51 PM


All times are GMT -5. The time now is 12:59 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC