Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6607193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:28:37+00:00 2026-05-25T19:28:37+00:00

I’m still new at this, so bear with me: I created a new Window-based

  • 0

I’m still new at this, so bear with me:

I created a new Window-based application in XCode 4 that happens to be a universal app. After that, I programmatically created a TabBarController with the associated view controllers (just basic views with 1-2 labels to help me identify each version (iPad, iPhone).

When I run the app and switch tabs, the viewDidLoad method does fire, the title appears correctly, but the visual view does not switch. It remains at the default MainWindow(device).xib file for each version. What am I missing here?

adding the tabs programmatically:

- (void) addTabs
{
//set up a local nav controller which we will reuse for each view controller
UINavigationController *localNavigationController;

//create tab bar controller and array to hold the view controllers
tabBarController = [[UITabBarController alloc] init];
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:2];

//setup the first view controller (Root view controller)
HomeViewController *myViewController;
myViewController = [[HomeViewController alloc] init];

//create the nav controller and add the root view controller as its first view
localNavigationController = [[UINavigationController alloc] initWithRootViewController:myViewController];

// add the new nav controller (with the root view inside of it)
// to the array of controllers
[localControllersArray addObject:localNavigationController];

//release
[localNavigationController release];
[myViewController release];    

//setup the second view controller
MapViewController *secondViewController;
secondViewController = [[MapViewController alloc] initWithTabBar];

localNavigationController = [[UINavigationController alloc] initWithRootViewController:secondViewController];

[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[secondViewController release];

tabBarController.viewControllers = localControllersArray;
[localControllersArray release];

 }

and MapViewController.h is basic – there’s really nothing there:

#import "MapViewController.h"

@implementation MapViewController

- (id)initWithTabBar {
if ([self init]) {
    //this is the label of the tab button itself
    self.title = @"Map";

    //image goes here
    //self.tabBarItem.image = [UIImage imageNamed:@"name_gray.png"];

    //set the long name show in the Navigation bar at the top
    self.navigationItem.title = @"Map View";

}

return self;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}

- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}




// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
   NSLog(@"Am I loading?");
}


- (void)viewDidUnload
   {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
  }

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSLog(@"Testing");
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
   [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
   [super viewDidDisappear:animated];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   // Return YES for supported orientations
   return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end

Now, there is no MapViewController.xib file, but the MapViewController_iPhone.xib and the MapViewController_iPad.xib files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:28:38+00:00Added an answer on May 25, 2026 at 7:28 pm

    They Should be named: ~iphone, and ~ipad, and not: _iPhone and _IPad. The reason for this is that this is the format the reference says it to be.

    Also note that the Simulator is NOT case sensitive, whereas the iOS device is, so make sure that you have the nib formatted as above, otherwise, it will only work on the Simulator.

    Hope that Helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.