Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename an xib file in Xcode 4?

I renamed an xib file in Xcode4, just by highlighting in the project organizer and changing the name, but it seems to confuse the project. For example, if I add a new button to the view, it doesn't show up when I run the project. However, if I rename it back to the original name, it shows up. What's the correct way to rename an xib file?

like image 743
Jack BeNimble Avatar asked Nov 05 '25 17:11

Jack BeNimble


1 Answers

Xcode can sometimes be very picky with name-changed XIBs; the way that works best for me is as follows:

  • Remove the reference to a XIB file from my open project
  • In Finder, rename the file(s)
  • Drag them back to the project

You may still encounter errors either side of this process - and on other occasions, renaming the file by a (slow) double click on said file will work.... for errors like these, I find that by going Project -> Clean will also help.

Keep us posted!

like image 91
Luke Avatar answered Nov 07 '25 09:11

Luke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!