|
|
#1 |
|
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];
}
|
|
|
|
0
|
|
|
#2 |
|
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. |
|
|
|
0
|
|
|
#3 |
|
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.
|
|
|
|
0
|
|
|
#4 |
|
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];
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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.






Linear Mode

