So I've been messing around with xcode for the last couple of weeks, and as of last night I had a nice simple application that had a UIPickerView with 3 components, two labels, and it printed to each of them based on what was selected.
When I went to move on, i wanted to place an image that was scrollable, but I realized that I needed to change something, and I deleted the UIImageView(embedded in a UIScrollView). This immediately caused my app to break because there were still things linked in the .xib xml code that no longer existed. I tried to go in manually to take them out, and long story short, I broke it...badly.
My question is: Is there any way to generate a new .xib file for my existing project so I don't have to make an entirely new one?
preguntado el 27 de agosto de 11 a las 21:08
I know that this is an old post, but I had a similar experience today, and thought I would add my two cents. Someone may find this post like I did, and find it helpful. I had a backup, but didn't want to update my code with all the changes since my last update.
I tried closing all files in Xcode and rebooting, which didn't fix the issue. I figured the problem was related to an outlet I had created, and then removed. After the reboot, I chose to ignore the crash option when opening the .xib, and instead chose to continue. I poked around in the .xib enough to flag it as changed, and then saved it. That fixed my problem. I can now open the .xib without a crash warning, and the app works properly.
If I understand you correctly, you're asking to replace the .xib file with a new blank one so you don't have to junk this whole project.
You could create a new XCode project with the same name in a different directory, then copy the .xib file from that project on top of the one you broke. Close XCode before you do the copy. Then restart XCode and you can add back in the elements you had before and drag out the various linkages you need.
I would also second the comment about turning on source control so you can go back a step when you next make a mis-step.
Delete the current file.
- Archivo nuevo
- Interfaz de usuario
Create file with the same name as the previous (deleted) one.
Inside Interface Builder select the Propietario de archivos (place holders), select the Inspector de identidad, cambiar el Clase to the View Controller (of the same name).
Lastly and not least importantly add to control de versiones.