1

I read up other questions and it isn't very clear, as to what I could do about this problem. Decided to ask anyway.

So I have a UIViewController, wherein I block auto-rotation.

I bring up one of the subviews added to the controller. Now, I rotate the device. And this UIView should change orientation, I will use autolayout to support all orientations on this view alone.

Is this possible?

What I tried is to, listen for device orientation changes, and then send the orientation to the subview and then was thinking probably transform, but that won't be accurate and it is probably a lot of work.

Any clue?

1
  • Well yes. I will put up an answer.
    – esh
    Mar 25, 2014 at 4:28

1 Answer 1

0

So, there isn't any direct method without using another view controller to hitch the view to. Add a new UIViewController and make your UIView the view controller's view. Add your rotation parameters/methods to the newly made view controller.

So its not the best solution because I have to now present that view from a view controller which is adding more code. That's kinda fundamental to a UIView. It can't handle itself unless you write hacks and override your view's behavior.

Another solution is to listen to changes in interface orientations and then relayout your view based on that change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.