1

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?

Alex Tau
  • 2,639
  • 4
  • 26
  • 30
  • Look for the files in the finder (rightclick or two-finger tap or corner tap a file->show in finder) rename It there. Xcode usually looks for literal files, so changing the name on Xcode only changes the name of the file Xcode looks for, so you get the red name. – CodaFi Sep 22 '11 at 20:42
  • Did you change the name within xcode? – nykash Sep 22 '11 at 20:44

3 Answers3

4

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.

Keith John Hutchison
  • 4,955
  • 11
  • 46
  • 64
AliSoftware
  • 32,623
  • 6
  • 82
  • 77
3

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

Community
  • 1
  • 1
Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
0

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.

casillas
  • 16,351
  • 19
  • 115
  • 215