开发者

How to add new xib files

开发者 https://www.devze.com 2023-03-30 19:13 出处:网络
I ha开发者_运维问答ve 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?(Assuming XCod

I ha开发者_运维问答ve 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?


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


For XCode 8 and swift 3:

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

Name it "YourViewController.xib" and saved it.


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


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.

How to add new xib files


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

精彩评论

暂无评论...
验证码 换一张
取 消