Question

I have a view with two buttons that serve as segues to other views. Autolayout is disabled and I have set the frames for the buttons in portrait and landscape programatically via CGRectMake. When I navigate to the view containing the buttons, they are in the proper position. Additionally, the buttons appear in the correct frames upon rotation.

However, when I switch to another view, change orientation, then return back (i.e., click the first button to segue to a different view, rotate that view, then return to the original view), the buttons are no longer in the proper frames. This occurs for either orientation change.

I am guessing it is because the initial view, whether portrait or landscape, is placed on a stack, and then I can no longer set the frames after that. Is there some form of unloading that needs to take place, or some additional code that needs to check for orientation shifts before loading back? Thanks, it is much appreciated.

Was it helpful?

Solution

ok it seems that you have dynamically set your button.

there another way of autoresize option.

enter image description here

enter image description here

select your button in xib goto > inspector (fifth selected tab). here you can set your button as per view. how the object will look like in diffrent orientation will be shown by the beside window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top