ios - buttons disappear on rotation -
i'm reworking existing project allow screen rotation , multiple devices whenever rotate screen in simulator, buttons disappear. started scratch toy example works not active project. things cause this? in storyboard auto layout.
as per question first must check whether application using size class or not , 1 other thing please check constraints breaking or not while changing orientation.
it issue not breaking of constraints follow below procedure. if can see per below image need change constraints only.
secondly if not need use size class selecting main.storyboard or viewcontroller.xib.
then need go file inspector , select use size class below use auto layout.
for making application multiple device orientation size class comes in handy.
please have @ images below.
application without size class
result how ui displayed in device.
enabling size class file inspector.
once have made changes , viewcontroller able change constraints according device of different orientation.
wany-hany size class - device display view in in landscape or portrait. add required controls in size class.
wcompact-hregular size class - for iphones in portrait mode only. if have added control in size class not displayed when application in landscape mode , not in ipad either.
wany-hcompact size class - for iphones in landscape mode only. if have added control in size class not displayed when application in portrait mode , not in ipad either.
final result when displayed in device or simulator. label displayed in portrait mode , invisible in landscape mode.
conclusion. displaying label in landscape mode need add label in wany-hany size class , change constraints portrait , landscape modes. ipad can use wregular-hregular.
hope helps in solving problem.
Comments
Post a Comment