I need a button to be installed in portrait orientation while another button is uninstalled in portrait orientation (any width, any height), while the reverse should occur in landscape orientation (any width, compact height). One of these buttons is part of a UIStackView
and the other is part of a UIView
.
When in portrait the button in the UIStackView
should be installed, but the button inside the UIView
should be uninstalled, with the reverse occurring as I mentioned earlier in landscape. Currently I'm checking the userInterfaceIdiom
in my view controller for the storyboard, but would like to rely entirely on Interface Builder
if possible.
When removing my code (that actually makes it behave correctly), and simply relying on Interface Builder
for installing/uninstalling the buttons based on size class
, the button installed for landscape orientation always lays out correctly, but when rotating back to portrait, the other button that should now be installed is completely misplaced, out of it's original UIStackView
, and that UIStackView
that it should stay in, but hasn't, is now expanded to fill in the missing space where that button should have been. When this is happening, there are no warnings or errors from UIKit
in the log, and my storyboard shows no conflicts. I'm thoroughly stumped!
At first glance this seems like an easy solution. Simply check/uncheck the install box for size classes
of a UI element. Although, even after reading Apple docs and tutorials this is proving to be more difficult and obscure than I expected.
To clarify, I do not have constraints set for the button installed for portrait orientation since it is inside a UIStackView
. On the other hand, I do have a few constraints set for the landscape orientation button. Although, the button in the UIStackView
is the only one giving me trouble.
The view debugger is not working either in Xcode 7, and I'm receiving the error: warning: could not load any Objective-C class information from the dyld shared cache. This will significantly reduce the quality of type information available.
when attempting to use it.
I believe this may be a bug and related to this post: UIStackView properties according to size classes
Your help is greatly appreciated! Thanks.