开发者

Can't Rename Files In Xcode 4 Anymore?

Seriously, in previous versions of XCode I could right-click a file or group in XCode and I would get the "rename" option. In XCode 4 I can't seem to rename my files in XCode directly anymore. What happened? Why would Apple remove such a feature? H开发者_C百科ow can I rename my nibs, image resources, and others in XCode now?


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!

Can't Rename Files In Xcode 4 Anymore?


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


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.


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜