Rotate only subview of a uiviewcontroller

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?

Answers


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.


Need Your Help

how to develop a multi player chess?

c# .net chess

I wana develop a multi-player chess using c# but I don't have any idea of how to implement the restriction rules of chess with c# to be honest i've never done even a little bit of game programming ...

Meteor: Bootstrap Modal breaks when handlebars values change

twitter-bootstrap modal-dialog meteor

I'm making a modal to handle payments, and I want to use some handlebars helpers to do form validation.