Using XCode storyboard to instantiate view controller that uses XIB for its design

我与影子孤独终老i 提交于 2019-11-28 17:31:00
matt
  1. Delete the View contained by the view controller in the storyboard.

  2. Then provide the view by configuring a nib file with the same name as the view controller class. For example if the view controller class is called MyViewController, name your xib file MyViewController.xib.

EDIT Note that Swift seed 5 started breaking this technique, because it mangles the name of the .xib file it's looking for. See my answer here for workarounds: https://stackoverflow.com/a/25539016/341994 Basically this name matching was broken in iOS 8, but then Apple repented and fixed it so that it works again in iOS 9.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!