Note that there are some explanatory texts on larger screens.

plurals
  1. POPlease clear some confusions regarding UIViewController
    primarykey
    data
    text
    <p>Please clear some confusions regarding <code>UIViewController</code></p> <p>I found this article <code>Abusing UIViewController</code> and here are the links <a href="http://littlehales.wordpress.com/2012/01/25/abusing-uiviewcontrollers/" rel="nofollow">link1</a> &amp; <a href="http://blog.carbonfive.com/2011/03/09/abusing-uiviewcontrollers/" rel="nofollow">link2</a> </p> <p>and summarised points</p> <p>This is author's (and Apple’s) advice In a nutshell:</p> <ol> <li>One (and only one) view controller should be responsible for a whole hierarchy (or screenful) of UIViews.</li> <li>Mostly, you should only use one view controller per screen. Essentially the <code>rootViewController</code> of the current <code>UIWindow</code> should be the only <code>UIViewController</code> with a visible view.</li> <li>Each different screen should have a different view controller i.e. one controller should not control more than one screen.</li> <li>You should NOT nest custom <code>UIViewControllers</code> within a view hierarchy.</li> <li>If more than one <code>UIViewController</code> hangs off the application’s <code>UIWindow</code>, only one of these will get the messages for changes in orientation. The other(s) will NOT get these messages.</li> <li>Nested <code>UIViewControllers</code> are not guaranteed, or likely, to receive messages for changes in orientation or lifecycle messages such as <code>viewDidAppear:</code>, <code>viewWillAppear:</code>, <code>viewDidDisappear:</code> and <code>viewWillDisappear:</code> even though they inherit from <code>UIViewController</code>. Only the topmost <code>UIViewController</code> is certain to get these messages.</li> </ol> <p><strong>Please clear point number 2 and 3</strong> because when we use <code>UINavigationController</code> or <code>UITabBarController</code> we use multiple subclasses of <code>UIViewController</code>. And ios device has only one screen.....</p> <p>This article <a href="http://blog.carbonfive.com/2011/03/09/abusing-uiviewcontrollers/" rel="nofollow">Abusing UIViewController</a> highlight apple suggestion </p> <blockquote> <p>Note: If you want to divide a view hierarchy into multiple subareas and manage each one separately, use generic controller objects (custom objects descending from NSObject) instead of view controller objects to manage each subarea. Then use a single view controller object to manage the generic controller objects.</p> </blockquote> <p>and in <a href="http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ManagingDataFlowBetweenViewControllers/ManagingDataFlowBetweenViewControllers.html#//apple_ref/doc/uid/TP40007457-CH8-SW1" rel="nofollow">apple docs</a> under heading of <code>Coordinating Efforts Between View Controllers</code> apple saying</p> <blockquote> <p>Few iOS apps show only a single screenful of content. Instead, they show some content when first launched and then show and hide other content in response to user actions. These transitions provide a single unified user interface that display a lot of content, just not all at once.....</p> </blockquote> <p>My requirement is <strong>NOT</strong> to use any container or modal or popover, I want to do manual management, I have two view controllers <code>VC1</code> &amp; <code>VC2</code>. <code>VC1</code> is the root view controller now I want to switch/transit/move to <code>VC2</code> what should I do?</p> <ol> <li><p><code>VC1</code> should be the only subclass of <code>UIViewController</code> and <code>VC2</code> should be the subclass of <code>NSObject</code> to manage a particular view in <code>VC1</code> hierarchy?(the show hide thing by apple doc).</p></li> <li><p><code>VC2</code> can also be the subclass of <code>UIViewController</code>, I just remove <code>VC1</code> from root view and add <code>VC2</code> as root view?</p></li> </ol> <p>or what is the correct way?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload