Hi All,
I have a question about View Controllers in Storyboard’s.
In the past I have handled Landscape and Portrait Views as two separate
Hierarchies in XCode/IB. I defined the roots Views inside the View Controller
but NOT in the main .view. I then hooked these up to the View Controller Class
as IBOutlets and then adding one or the to the main view in viewWillAppear. E.g.
In IB:
Main “view” - empty.
LandscapeRootView - Hierarchy of Views.
PortraitRootView - Hierarchy of Views.
In the View Controller Class:
@property (nonnull,strong) IBOutlet UIStackView*
pPortraitRootStackView;
@property (nonnull,strong) IBOutlet UIStackView*
pLandscapeRootStackView;
Then in viewWillAppear:
[self.view removeAllSubviews];
if (Orientation == Portrait)
[self.view addSubview:self. pPortraitRootStackView];
else
[self.view addSubview:self. pLandscapeRootStackView];
However when I come to do this in a Storyboard, I can create the Views OK, but
it XCode/IB won’t let me hook it up to the Outlets.
I’m using Auto-layout and can’t find a way to make it work with just one view
hierarchy as the constraints clash.
Any ideas on how to achieve this would be greatly appreciated.
All the Best
Dave
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]