Ultime
News

Ultimi
Articoli

Numeri
Fortunati

eLibrary

Xcode: Add a storyboard to an empty project

xcode

- From contextual menu select "New File..."
- Choose "User Interface" file type and Storyboard template
- Select the "Device Family" of the storyboard (iPhone, iPad)
- Give it a name and press "Create" button
- Go into "Supporting Files" group into project tree and select the "xxx-info.plist" file where xxx is the name of your project
- Add a key value row with "Main storyboard file base name" as key and the name you've given to your storyboard (only the name and not the suffix)
- Go into "AppDelegate.m" file and into the "didFinishLaunchingWithOptions" method code but the instruction "return YES;"
- Add a scene as entry point to your storyboard dragging a "View Controller" object into the storyboard space
- Give to your new View Controller a consistent name in this way "xxxxxx View Controller" with xxxxxx as name
- Now again from contextual menu select "New File..."
- Choose "Cocoa Touch" file type and "Objective-C class" template
- Give it a name like "xxxxViewController" with xxxxxx as name
- Select "UIViewController" for "Subclass of" property
- Uncheck if necessary "With XIB for user interface" property
- Create it
- Now select the storyboard and its graphical View Controller
- Go into the "Identity Inspector" and as Custom class select your new UI View Controller class just create (it should be in the list of the available "Custom Class"
- Now you are ready to code!

  • 02/12/2012
  • Fonte: Titano
twitter facebook Seguici anche su

Tutti gli articoli