Can't Rename Files In Xcode 4 Anymore?

限于喜欢 提交于 2019-12-05 01:13:41

The contextual menu item was removed, but you can still rename from within. Select the file and then click again in the name and you should get the editor field. Type away to rename. It can be a little temperamental though. The biggest problem I usually have is doing the 2nd click too quickly and it being registered as a double click. So you might need to play around with your timing a little bit to get used to it.

If you want the CM item back, make sure to file a bug report on it.

Note that if you're renaming a class, the best way I've found to do this is to open the class header, select the name of the class then control-click and choose Refactor / Rename. That way Xcode will rename the .h and .m files and replace instances of your class name (almost) everywhere it appears, including XIB files. Nifty!


Edit: in Xcode 4.2, watch out for this gotcha: "When initiating a refactoring rename operation from the declaration of a property, any Interface Builder files that refer to that property will not be updated correctly. Instead, perform the rename operation on a usage of the property, or an associated @synthesize statement."

Select the file in the navigation window and press Enter. Just the way renaming in Finder.

In case you want to change the path in case you moved some files...

Step 1: View -> Utilities -> File Inspector to open the file inspector Step 2: Under Identity -> Path there is a white icon to change the relative path of the file

Furthermore, to rename the file, just refactor as stated above ;)

another way you can do it, is by using the little rectangle with an arrow in it which is at the bottom of the bar. Click on it, your items will be displayed in a list like view, you can rename it there the way you would rename files or whatever... Hope that helps

If you want to rename non-class files like png files just select file and choose 'Show File Inspector' from right click, then change file name from 'name' textfield (identify and type label).

I you want change class name, I recommend 'Simon Whitaker' Refactor method (second comment).

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