I have a project with two targets, let's say appA and appB.
Both targets share code of main view controller (appViewController) except the .xib files.
I also have two sets of png's each for one target.
My file/project structure looks like:
*common* (members of both targets):
appViewController.h
appViewController.m
*appA* (members of target appA):
appViewController.xib
set of png files
*appB* (members of target appB):
appViewController.xib
set of png files
PNG's in both sets have the same names but they are placed in separate folders/groups and one group is member of one target and the other of the other target (same with appViewController.xib)
Everything works fine except when i try to edit .xib files in IB - it seemes to get confused and show partly images from one target and partly from the other.
Since .xib's are somewhat complex (>40 images) editing one with partly wrong images is almost impossible - images have to be properly placed on one background image (background image is also different for appA and appB).
The problem exists only at edit-time (in IB). After compilation all the images in both targets are correct.
I found one quick & dirty solution to this. Before i start editing one .xib i remove references to the other set of png's. That way IB shows correct images for the .xib i'm editing. I simply import back all the references (png's of the other target) when i'm done.
I found a similiar question which was not really answered.
I wonder, does anyone have a cleaner solution to this? There has to be a better way to do it.
No answers so far...
So let me answer my own question (still hoping for a better answer).
When you want to edit .xib of one target, you remove the references of the other targets' resources (pngs).
Then you quit xcode and open your project again. The pngs will be the right ones (since xcode doesn't hold references to the wrong ones at the moment).
When you're done - reimport deleted references (take care that you check the right 'target membership').
Edit: This seems to be a known issue with IB - XCode. Till they resolve it we'll just have to use workaround mentioned above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With