rename xib file

给你一囗甜甜゛ 提交于 2019-12-24 11:12:43

问题


I started to create an app using tabbar app template provided in xcode. Then I wanted to change the names of the files: FirstViewController should become YellowViewControler and FirstView.xib should become YellowViewcontroller.xib. Changing the name of the xib wasn't done right. It became red as if it didn't exist in the project. So: how should I change the name of the xib files?


回答1:


Use the "Refactor" tool of Xcode.

This will manage the renaming of the XIB file, the renaming of the interface & implementation of the source file containing the definition of the ViewController, the renaming of your class declarations/definitions, and any references that are used anywhere in your projects, all of this in one action.




回答2:


Rename the stuff back to what their original name was (FirstViewController) and then go to the interface file for it (.h) and right click on the class name (FirstViewController) and click refactor. This should make sure everything gets changed correctly.

Source this question




回答3:


Most likely your viewcontroller name still linked to previous owner therefore open the viewcontroller.xib in source code and find the owner and changed to current name. It will fix the problem right away.



来源:https://stackoverflow.com/questions/7521132/rename-xib-file

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