45

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?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
ilaunchpad
  • 1,283
  • 3
  • 16
  • 32

5 Answers5

37

(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.

codelark
  • 12,254
  • 1
  • 45
  • 49
11

For XCode 8 and swift 3:

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

Name it "YourViewController.xib" and saved it.

xhinoda
  • 1,032
  • 1
  • 19
  • 26
10

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."

Evan Mulawski
  • 54,662
  • 15
  • 117
  • 144
8

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.

enter image description here

Vladan
  • 371
  • 6
  • 13
2

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

raycamwu
  • 21
  • 2