Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Lets get to the <code>UIView</code> and the <code>UIViewController</code> class first</strong></p> <p><code>UIViewController</code> is a Cocoa Touch class built for the purpose of managing UIViews. It expects to have a view hierarchy, but you don't "automatically" get a view (this is slightly inaccurate; see edit below). Usually you will obtain views by calling <code>initWithNibName</code> on your view controller.</p> <p>There is some built-in magic in Interface Builder which knows that if File's Owner is a <code>UIViewController</code> (or subclass), there is a property called view. That's about it.</p> <p>Once you have linked a view controller and a view, the view controller does a fair amount of work for you: it registers as a responder for view touch events, registers for device rotation notifications (and handles them automatically, if you wish), helps you take care of some of the details of animation, and handles low-memory conditions semi-automatically.</p> <p>If you don't call <code>initWithNibName</code> or set the view property manually, the view property getter will invoke loadView if view is nil. The default implementation of loadView will see if you've set nibBundle and nibName and attempt to load the view from there (which is why you don't have to call initWithNibName, most of the time), but if those properties aren't set, it will instantiate a UIView object with default values. So technically, yes, it does automatically come with its own <code>UIView</code>, but most of the time that's of little value.</p> <p><strong>Now coming to the TableView and the UITableViewController class</strong></p> <p>A <code>TableViewController</code> is a <code>ViewController</code> with a TableView built in. This will have the delegate methods needed already declared and setup. This VC is already a TableView delegate and datasource. It cannot be resized. Upside is ease of use, downside is very limited flexibility.</p> <p>A <code>TableView</code> is just that a TableView (subclass of <code>UIView</code>). It can be added to a ViewController and resized, used alongside another view based object, etc. The upside is the flexibility, the downside is that you have to setup the delegate and datasource methods yourself (in my opinion, well worth the time to get the flexibility).</p> <p>One other note is that when using the new Static TableView cells (part of iOS5), you have to use a TableViewController.</p> <p>Also please check the following links for a detailed explanation of the methods.</p> <p><a href="https://stackoverflow.com/questions/5788963/view-and-viewcontroller">view and viewcontroller</a></p> <p><a href="https://stackoverflow.com/questions/5280319/what-are-controller-classes">What are controller classes?</a></p> <p><a href="https://stackoverflow.com/questions/4669783/what-is-the-difference-between-view-and-viewcontroller-in-iphone">What is the difference between UIView and UIViewController?</a></p> <p><a href="https://stackoverflow.com/questions/3626737/whats-the-difference-between-the-rootviewcontroller-appdelegate-and-the-view-c">What&#39;s the difference between the RootViewController, AppDelegate and the View Controller classes that I may create?</a></p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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