Search code examples
ipadcocoamodel-view-controllerscene

Cocoa: scene vs. view


Noob question here. I think I get the basics of the three basic Model-View-Controller elements. Sort of. But what is a scene? I know iPad can have more than one scene per screen, and iPhone/iPod can have just one. But how does a scene relate to a view?

If I'm getting it horribly wrong, please be kind :)


Solution

  • A "scene" is a UI abstraction Apple introduced into XCode to allow for storyboard mechanics in Interface Builder.

    Prior to this, in Interface Builder, you created (and still can) Views which were attached to ViewControllers.

    With Scenes, Segues and Storyboards, you have a way to define the UI flow from a view attached to a view controller (a scene) to another scene through a "segue". A segue being the action that you can visually define in Interface Builder as a trigger to move to another View (attached to a view controller)

    At the abstract level a scene is a view attached to a view controller and you can have as many as you wish in a XIB whether it be for iPhone or iPad.

    It really only depends whether you are in the storyboard editor or interface builder. You get an option on project creation to create storyboards for your new iOS project.