Reputation: 682
I have a project in Xcode, lets name it A
, in which I have a story board and several views. I only need part of project A
. Hence, I made a new project, B
, and made a new UIViewController
, with xib, and copied the two UIViews
from project A
to B.
It looks like this now, where RPM Display
and Speed Display
are copied (by dragging from xib) from A to B.
AnalogDisplayContainer
belongs to the class PD_AnalogDisplayContainer
, and we have two outlets in class PD_AnalogDisplayContainer
:
@property (nonatomic,assign) IBOutlet PD_AnalogDisplay* speedDisplay;
@property (nonatomic,assign) IBOutlet PD_AnalogDisplay* rpmDisplay;
which are connected to the respective views in xib
. (We have exactly the same code in project A
.) These UIViews
have some UILabels
as well, which are automatically copied in project B
, and I need them as well. You see them here:
Up to here, the description of what I did. Now, the problem:
I have three outlets in class PD_AnalogDisplay
.
@property (nonatomic, assign) IBOutlet UILabel* unitLabel;
@property (nonatomic, assign) IBOutlet UILabel* digitalIntegerValue;
@property (nonatomic, assign) IBOutlet UILabel* digitalFloatValue;
However, so strangely, when I click on the small point beside these outlets, it shows me the connections to story board,
and when I click on the connection, I see the whole storyboard and views from project A.
In addition, these connections are not shown when I click on xib.
I searched in project B, there is no storyboard, or all these things I see in the previous picture, in form of code. So I don't know where it all come from. And I get the run time error: loaded the "RPMViewController" nib but the view outlet was not set.
Upvotes: 0
Views: 125
Reputation: 4561
Yes, it brings previous reference wherever you copy it. It is happening because the class name is same in project A and B. Create class name in project B other than class name in project A or slightly change variable name.
Assign that class to your xib file.
You must recreate the IBOutletes
from xib file.
Just copy the interface components not the code in .h file.
Observations:
Upvotes: 1