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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:50:05+00:00 2026-05-28T05:50:05+00:00

Is it a best practice to use more than one xib in a view

  • 0

Is it a best practice to use more than one xib in a view controller for a responsive design?

I’m currently implementing an app that relies heavily on a remote API for its data. One particular view is troubling since the layout depends on the data returned from that API. It is either a product that has a full review and pricing, or a product that we only have limited information on.

The design is responsive to the data. Depending on how much information that is returned, the view has a layout that is much different from the other. Also, there’s a quite a few elements that need to be repositioned depending on text length, etc. I had originally implemented the design nearly all in code, but that became quickly unmaintainable so I offloaded almost all of it to the xib and only use code to reposition elements.

Using more than one xib might be a good solution. When the view loads, the controller performs the API request, then loads the new xib if need be. I’m not sure of what downsides there may be to this approach.

  • 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-28T05:50:05+00:00Added an answer on May 28, 2026 at 5:50 am

    I’m implementing now the client-server app. Layout of the most of views is also depending on data from API. In situation like yours I’ve created several xib files (one for detailed product, one for limited etc.) and depending on server response I’m choosing xib to load. Code sample:

        // load proper view from nib
        NSArray *nibViews;
        if(product.details) {
            nibViews = [[NSBundle mainBundle] loadNibNamed:@"DetailedView" owner:self options:nil];
        }
        else {
            nibViews = [[NSBundle mainBundle] loadNibNamed:@"NormalView" owner:self options:nil];
        }
    
        // create and initialize product view object
        ProductView *productView = [nibViews objectAtIndex:0];
    
        // configure a view here..
    

    Yo could put all versions of view into one xib. In that case you only change index in nibViews objectAtIndex:

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

Sidebar

Related Questions

I need to change an interface that is used by more than one app.
Would it be considered best practice to use a single template that changes it's
The best practice seems to be to use assert for a condition that should
What is the best practice to use when one needs to store a lambda
This is more of a general best practice question rather than a very focused
Let us ignore for a moment Damian Conway's best practice of no more than
Best practice is to use unique ivs, but what is unique? Is it unique
What is the common way (or best practice) to optionally use JNI? E.g. I
It is considered best practice for encapsulation to use private fields with accessors (getters
As I understand it, the best practice for generating salts is to use some

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.