Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Spadict, There are a few things wrong here. Firstly, i care about trivial nitpicking less than most people, but it reeeeeally helps to get the language right. Really it does. Lets go slowly..</p> <p>If you have a class 'ControlsViewController' (note the uppercase C) you can use it whenever you like. You can <strong>instantiate</strong> as many <strong>instances</strong> as you like, whenever you like. Reading the documentation for UIViewController (I'm assuming here that ControlsViewController is a class that you wrote and that it is a subclass of UIViewController) tells us that the designated initializer is <strong>-initWithNibName:bundle:</strong> . These means that usually we will use it like so:-</p> <pre><code>ControlsViewController *controls = [[ControlsViewController alloc] initWithNibName:@"aNib" bundle:nil]; </code></pre> <p>Another way to create an instance of a class is using Interface Builder. In Interface Builder you can create as many instances of any Class you like, tweak their properties, then save them as is, configured just as you like, to a nib file. This is a good way to create your GUI instances, your windows, buttons, views, etc. because you can visually manipulate positions and sizes, and you can add a button to a view, or a view to a window by dragging and dropping - which is easier than coding. </p> <p>A .nib file is comparable to a .zip file. We don't really care about the .nib file - we care about the <strong>instances</strong> of objects that we archived inside it. We are not <strong>unarchiving</strong> the .nib file, we are unarchiving the objects we created with Interface Builder and then archived as a nib file.</p> <p>Everytime we <strong>load the nib file</strong> we get recreate the objects inside it, as they were when we saved the nib. As an example:- in Interface Builder i create a Window and i set it's background Colour to black and it's width to be 600px. I save it to a nib (there is one window object in this nib - but there is no limit to how many objects or what type). </p> <p>When i run the app i load the .nib 5 times. I now have 5 Windows with black backgrounds that are 600px wide.</p> <p>UIViewController's designated initializer takes the name of a nib as it's first argument. When we create an instance of UIViewController it will call '-loadView' to load the nib that we pass in, unarchiving the objects within. You never need to call '-loadview' and using a nib is in no way an alternative to this method.</p> <p>So, a view can be created programatically, or created with Interface Builder and then loaded from the nib. Neither of these "involves drawing the view programatically". Once you have a view you can tell it to draw, and you might do this 50 times a second or you might do it once, but that is a separate operation.</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.
    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.
 

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