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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:49:49+00:00 2026-06-17T18:49:49+00:00

I have a subclass of UIViewController : @interface KBViewController : UIViewController with multiple xib

  • 0

I have a subclass of UIViewController:

 @interface KBViewController : UIViewController

with multiple xibs, for example, one is a Qwerty and the another is Dvorak layout:

 KBViewControllerQuerty~iphone.xib
 KBViewControllerDvorak~iphone.xib

So when the user click a button, Qwerty is switch to Dvorak. As you may see, the code logic is identical for both keyboard layouts. What I need is to reload the view with another xib.

Hopefully, all the buttons in the Dvorak xib will be hooks to the responding IBOutlets in KBViewController.

What is the right way to switch between the two xibs?

  • 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-17T18:49:51+00:00Added an answer on June 17, 2026 at 6:49 pm

    All Nibs has the designated File's Owner. IBOutlet and IBAction linking is done based upon the File's Owner. So you could define a view controller and two Nibs, with each Nib file’s File's Owner set to the defined view controller.

    That is, if you set File's Owner of all KBViewController*.xib files to KBViewController and have a KBViewController object somewhere you could load the KBViewController*.xib you want by initWithNibNamed method (recreate the view controller)

    If you should maintain the same KBViewController object all along, you could create a KBViewController object without Nib. In KBViewController.m, implement loadView and manually load the UIView object with -[NSBundle loadNibNamed] method (load and change self.view programmatically).

    UIView *someView = [[[NSBundle mainBundle] loadNibNamed:@"SomeNibFile"
                                                      owner:self
                                                    options:nil] objectAtIndex:0];
    self.view = someView;
    

    Note owner:self in above code. It must match with File's Owner of the @”SomeNibFile”.

    To change already loaded view:

    id superview = self.view.superview;
    [self.view removeFromSuperview];
    UIView *someView = [[[NSBundle mainBundle] loadNibNamed:@"SomeNibFile"
                                                      owner:self
                                                    options:nil] objectAtIndex:0];
    self.view = someView;
    [superview addSubview:self.view];
    

    More detailed explanation:
    Resource Programming Guide – Loading Nib Files Programmatically

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

Sidebar

Related Questions

I have made a UIViewController subclass without a .xib file, thinking I would not
I have: @interface SuperClass : UIViewController <UITableViewDelegate,UITableViewDataSource> And then @interface SubClass : SuperClass This
I have two viewControllers, one is a subclass of UIViewController (autoresizes correctly), the other
I have a very simple subclass of UIViewController : @interface RoastChickenViewController : UIViewController {
I have a UIViewController subclass that I am trying to have handle the shake
I have written a subclass of UIViewController which creates a view programmatically, instead of
I have an app where I subclass UIViewController and add some characteristics to it,
I have a custom UIViewController subclass, which gets pushed on a UINavigationController stack. I
I have a custom UIViewController subclass that handles all the view initialization by itself
I have a class named FirstViewController which is a subclass of UIViewController and I

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.