views:

314

answers:

2

I wanted to rename one badly named variable to something more naturally named (UITableView myListView --> myTableView). Did that with XCode "Edit - Find - Find in project" and replaced all found 7 items with the new one. Application compiled ok, started and crashed.

After some debugging found out that there was one (1) old name remaining inside XIB file xml spagetti (IBConnectionRecord, IBCocoaTouchOutletConnection)!

Question: how should I rename variables? Is there something that works right away?

+1  A: 

This is called refactoring and if you use the refactor tool that Xcode ships with, then also XIB variables will be renamed. Just highlight the variable/method you want to refactor, hit CMD + SHIFT + J and you see the refactor window.

It's probably best if you do this from the .h files.

Pascal
The variable was "global", referenced in few separate class files and in one XIB file. Refactoring feels like right solution, just didn't think I was doing anything that "advanced". Thanx, will remember this next time!
JOM
A: 

To rename local variables use

  • "Edit All in Scope"

As SanHolo already said, you could use

  • "Refactor" -> "Rename"

to rename global variables.

weichsel