Xcode trouver et remplacer dans le problème du projet par xib
-
18-09-2019 - |
Question
je voulais Renommer une variable mal nommée dans quelque chose de plus naturellement nommé (UableTview MyListView -> MyTableView). Fait ça avec Code de xé "EDIT - Find - Find in Project" et remplacé tous les 7 articles trouvés par le nouveau. Application compilée OK, démarrée et écrasé.
Après un débogage, j'ai découvert qu'il y avait un (1) vieux nom restant à l'intérieur du fichier XIB XML Spagetti (IbConnectionRecord, ibcocoatouchoutletConnection)!
Question: Comment devrais-je renommer les variables? Y a-t-il quelque chose qui fonctionne tout de suite?
La solution
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.
Autres conseils
To rename local variables use
- "Edit All in Scope"
As SanHolo already said, you could use
- "Refactor" -> "Rename"
to rename global variables.