Adding storyboard to existing project

后端 未结 6 762
温柔的废话
温柔的废话 2021-01-31 04:49

I have created a project without support of storyboards, but later I have added a storyboard. Storyboard work well and i see it\'s contents when loading app in emulator.

6条回答
  •  自闭症患者
    2021-01-31 05:24

    For XCode 6 and iOS8 beta2:

    1. Create a Storyboard file (let's call it Main.storyboard). Pick an iPhone or iPad for device type.
    2. In the blank Main.storyboard file, drag a UIViewController from the object library.
    3. If the storyboard is intended to be used as a universal storyboard, then switch to the File Inspector (in the Utilities section on the right), and check mark "Use Size Classes".
    4. Select the View Controller in the storyboard and switch to the Identity Inspector (in the Utilities section on the right), and type in the "Class" field the name of your View Controller.
    5. Find the file "info.plist" in the "Supporting Files" folder on the left in the Navigator section.
    6. Add a row by clicking on the '+' sign to the right of the "information property list" key.
    7. Select "Main storyboard file base name" key, and type the name of your storyboard file, in the "Value" field (in this case it will be called "Main")
    8. In AppDelegate.m/AppDelegate.swift, in the method/func "application:didFinishLaunchingWithOptions:" remove all code except "return YES" (for Objective-C), or "return true" for Swift.

提交回复
热议问题