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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:16:53+00:00 2026-05-26T05:16:53+00:00

In the introduction to iOS Programming: the Big Nerd Ranch Guide , the authors

  • 0

In the introduction to iOS Programming: the Big Nerd Ranch Guide, the authors say that they always create view controllers programmatically, and that instantiating view controllers in Xib files leads to projects that are difficult to comprehend and debug.

What, specifically, makes this problematic? And which difficulties would you encounter?

Are there any specific examples, and how does creating the view controllers in code avoid these problems?

  • 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-26T05:16:54+00:00Added an answer on May 26, 2026 at 5:16 am

    The quote is at Introduction > Style:

    We will always create view controllers programmatically. Some
    programmers will instantiate view controllers inside XIB file. We’ve
    found this practice leads to projects that are difficult to comprehend
    and debug.

    They talk about instantiation. If you have two view controllers A,B, you can alloc/init B in A’s implementation, or you can drop a reference to B in A’s XIB. In both cases, B may be defined in a XIB or not (the Big Ranch book advises to use XIBs for complex view controllers btw).


    Anyway, here is the difference:

    CitySelectionVC *citySel = [[[CitySelectionVC alloc] initWithCities:self.cities] autorelease];
    [self.navigationController pushViewController:citySel animated:TRUE];
    

    vs

    citySel.cities = self.cities;
    [self.navigationController pushViewController:citySel animated:TRUE];
    

    First case is a explicit instantiation in code. It tells me:

    • The VC is created now.
    • It needs the cities to work.

    The code in the second block references an outlet instantiated in the XIB. It tells me:

    • A VC was instantiated at unknown time, with unknown requirements.
    • I’m passing the cities.

    I favor the first style because it is more explicit, and gives me control of the lifespan of the object.

    In iOS 5 you can use Storyboards to create transitions and pass information between controllers. See Session 309 of WWDC2011.

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

Sidebar

Related Questions

Introduction Google chrome has a feature that allows you to create shortcuts to web
Introduction I've always been searching for a way to make Visual Studio draw a
Introduction I have been so annoyed by applications that have a startup dialog which
every introduction and sample that I can find seems to use GLUT or some
The DocInteraction sample code made available by Apple at http://developer.apple.com/library/ios/#samplecode/DocInteraction/Introduction/Intro.html (download: http://developer.apple.com/library/ios/samplecode/DocInteraction/DocInteraction.zip ) does
Introduction elem.hidden is a new property that allows to hide elements and detect whether
Introduction Let's say I have three Domain Objects: Proposition Phase Task A Proposition can
INTRODUCTION : I have a function(callback) that receives a object as an argument, inside
Has the introduction of the .net framework made raw programming in COM and DCOM
Short introduction Working on my first commercial iOS app, XCode 3.2 has proven to

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.