Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Bra, <code>UIViewControllers</code> have only one UIView as part of their guts.</p> <p>That is, "view" ... i.e. ... the actual property <code>view</code>, as in <code>self.view = something</code> or <code>view.hidden = YES</code>.</p> <p>However you can, of course, <strong>add as many subviews as you like</strong> to <strong><em>that view</em></strong>.</p> <p>This is how views are used normally. Almost every <code>.view</code> has subviews inside it.</p> <pre><code>UIView *bottomThing = [[UIView alloc] init]; bottomThing.frame = CGRectMake whatever UIView *otherThing = [[UIView alloc] init]; otherThing.frame = CGRectMake whatever [view addSubview:bottomThing]; [view addSubview:otherThing]; </code></pre> <p>In the example, we added two subviews to our main "built-in" view, which you refer to as simply "view". So we added bottomView to our "view" and we added topView to our "view."</p> <p>The subviews you add could be either plain old UIView, or, your own special subclass of UIView.</p> <pre><code>MySpecialView *bottomThing = [[UIView alloc] init]; bottomThing.frame = CGRectMake whatever ExtraordinaryView *otherThing = [[UIView alloc] init]; otherThing.frame = CGRectMake whatever [view addSubview:bottomThing]; [view addSubview:otherThing]; </code></pre> <p>(I guess FTR conceivably you could subclass <code>UIViewController</code> to have more than one view inside it, but that's completely pointless and irrelevant to this question.)</p> <p>From your <code>UIViewController</code> you can manipulate the subviews in any way you want.</p> <p>For example <code>[bottomThing doStuff:3.7]</code>, <code>bottomThing.hidden=YES</code>, etc etc.</p> <p>Once again it is absolutely normal to add more subviews inside your main "view" - this is the basic way in which iPhone apps are made. There is only one ".view" - you add more views inside it as you wish. Hope It Helps.</p>
 

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