How to add new xib files

后端 未结 5 1330
别跟我提以往
别跟我提以往 2021-02-02 06:18

I have to develop an app with multiple screens. I have automatically generated xib file, but for my other screen I need another xib file. How do I create another xib file?

相关标签:
5条回答
  • 2021-02-02 06:47

    (Assuming XCode 4)

    In the "File -> New File..." menu dialog, there is a subsection called "User Interface."

    You will notice in the description of each of the sub-items, it says "An Interface Builder Document." Those are various types of nibs.

    If you're creating a new ViewController specifically, you can also choose the "Cocoa Touch" section and select the "UIViewController subclass" item. There is a checkbox in the next page called "With XIB for User Interface." which will create the NIB as well as the associated class files.

    0 讨论(0)
  • 2021-02-02 06:49

    In XCode 10, you will need to go to New -> File -> Cocoa Touch Class

    Select "Also create XIB file" to get the interface, class, and XIB created in one step.

    0 讨论(0)
  • 2021-02-02 06:53

    For XCode 8 and swift 3:

    File -> New File -> iOS -> User Interface -> View

    Name it "YourViewController.xib" and saved it.

    0 讨论(0)
  • 2021-02-02 07:02

    In XCode 4:


    To create a standalone user interface (XIB):

    File -> New File -> iOS -> User Interface

    Then choose:

    • Application (includes delegate and window)
    • Window
    • View
    • Empty

    To create a new UIViewController class with a user interface:

    File -> New File -> iOS -> Cocoa Touch -> UIViewController subclass -> Click Next

    Then, name the new view controller class and select "With XIB for user interface."

    0 讨论(0)
  • 2021-02-02 07:05

    In XCode 5: ( Created a NEW someVC.xib when you just Deleted your old someVC.xib )

    more Steps need to done:

    tap : ClassNameWithViewController.xib , as processes in last answer , and IB opened

    choice: File's owner

    tap : Identity Inspector

    in [Custom Class] -> pull-down the [Class] window to selected -> ClassNameWithViewController

    back to tap : File's owner

    2 finger tap : File's owner -> open the Links Menu -> drag a line from [view's small-circle] to [View] in IB

    0 讨论(0)
提交回复
热议问题