开发者

Copy XIB files in Xcode - Change code - Old links remain

开发者 https://www.devze.com 2023-03-26 15:40 出处:网络
I\'m making a view based quiz app for iPhone with a lot of subjects and categories. Each of the categories consists of a number of questions with alternatives. When you answer correct, you go to the n

I'm making a view based quiz app for iPhone with a lot of subjects and categories. Each of the categories consists of a number of questions with alternatives. When you answer correct, you go to the next question. I've now designed an empty subject template where I simply insert the new questions and answers, and that's the files I need to copy and then modify when inserting a new subject. Here is what I've done:

  1. I duplicated all the template files (M, H and XIB) in Finder and changed the file names with Automator. OldNameViewController to NewNameViewController.

  2. Then I added the files into the project with "Add existing files".

  3. Next I changed all file names and navigation lin开发者_运维百科ks in the code with Find and replace. FirstSubjectQuestion1ViewController to SecondSubjectQuestion1ViewController.

But here is my problem. Although I've changed all the code, when I open one of the new XIB files and go into Files Owner, the navigation buttons are still hooked up with the old links, which doesn't even exist anymore in the code. There are hundreds of navigation buttons in my app, all linked in Files Owner, so I don't want to do it manually.

Anybody? I'm sure the answer is pretty simple, but I just can't find it out.


Instead of just renaming files, you should use the Refactor tool in Xcode 4. It will also fix your xib files and connections.

Copy XIB files in Xcode - Change code - Old links remain

Copy XIB files in Xcode - Change code - Old links remain


Yes, copying XIB entities like you did also copies their links (i.e. their "Files Owner" & "First Responder").

@jtbandes has suggested you the way to solve this...

0

精彩评论

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

关注公众号