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 9216311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:23:27+00:00 2026-06-18T02:23:27+00:00

I am studying Objective-C and I started to create an App while I am

  • 0

I am studying Objective-C and I started to create an App while I am learning it.
I have created a “Single View Application” with two “View Controllers” called “ViewController” and “secondViewController”, after that I thought to add an “UITabBarController”, so following a tutorial I used the following code in the AppDelegate.m

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

[self customizeInterface];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

UITabBarController *tabController = [[UITabBarController alloc] init];

UIViewController *viewController1 = [[UIViewController alloc] init];
UITabBarItem *tab1 = [[UITabBarItem alloc] initWithTitle:@"Artists" image:[UIImage imageNamed:@"artist-tab.png"] tag:1];
[viewController1 setTabBarItem:tab1];

UIViewController *viewController2 = [[UIViewController alloc] init];
UITabBarItem *tab2 = [[UITabBarItem alloc] initWithTitle:@"Music" image:[UIImage imageNamed:@"music-tab.png"] tag:2];
[viewController2 setTabBarItem:tab2];

tabController.viewControllers = [NSArray arrayWithObjects:viewController1,
                                 viewController2, nil];


self.window.rootViewController = tabController;

[self.window makeKeyAndVisible];


// Override point for customization after application launch.
return YES;
}

Here is the ViewController.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

If I run the application, the tab bar is working but I have a blank screen and not the ViewController I have created.
Just because I am a noob, could you please tell me how to link or show the view controllers respectively in each tab?

Please be so kind to say everything also the obvious things.
Thank you in advance

  • 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-06-18T02:23:28+00:00Added an answer on June 18, 2026 at 2:23 am

    Since you are beginner I would highly suggest you to use storyboards, that will help to manage the interface much more easier because you will not have to code almost anything.

    http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1

    I am just guessing but your problem might be that you directly init your view controller , you should call initWithNibName: method in your didFinishLaunchingWithOptions. The initWithNibName: is something that you call when you create a controller instance from a nib file.

    So basically initWithNibName: is called when the NIB is loaded and instantiated.

    I dont know your ViewContoller class names but you should change your view controllers init methods

    in your app delegate.m

    #import "ViewController.h"
    #import "secondViewController.h" 
    
    
        UIViewController *viewController1 = [[ViewController alloc] initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]]; // make sure on interface builder hat you Nib name is ViewController
    
        UIViewController *viewController2 = [[secondViewController alloc] initWithNibName:@"secondViewController" bundle:[NSBundle mainBundle]];// make sure on interface builder hat you Nib name is secondViewController
    

    and please use Upper Case Chars and detailed names for class name secondViewController is not good programming practice

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

Sidebar

Related Questions

I'm new to Objective-C world. What I have noticed while studying some iOS/Mac apps
I have started learning Objective-C, and I just wanted to verify that my understanding
I have just started studying Objective - C..and I encountered a problem which I
I have spent 1 week studying objective C. Now I am quite confused at
While studying about JMX, I have seen one of the important feature of it
After studying Hadley's book and searching here on SO I have created a heatmap
While studying C# in ASP.net I have trouble understanding several classes. In which scenario
While studying for the 70-433 exam I noticed you can create a covering index
I have just started studying Android, I have limited java knowledge but am semi
I'm studying an application in C for ARM low-powered devices, I have this piece

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.