开发者

Is it possible to auto-rotate a modal view but not its parent?

It seems that if a modal view's parent returns false to shouldAutoRotate... the modal view will also not开发者_StackOverflow autorotate. How can I have a main view which will never rotate, and a modal view which will always rotate?


You may try to observe for orientation events (UIDeviceOrientationDidChangeNotification) in your modal view controller and then add a transformation to your view layer using the CATransform3DMakeRotation to get an appropriate rotation around Z or basically with

[myLayer setValue:[NSNumber numberWithInt:M_PI*0.5f] forKeyPath:@"transform.rotation.z"]; // or - M_PI*0.5f depending orientation: left or right

You can also use an animation to get an animated rotation. Is it what you're asking for?

For observing orientation events read this chapter : Getting the Current Device Orientation

For Layer transform read this chapter : Layer Geometry and Transforms

Regards.

V.Zgueb


Yeah, sure you can. Pretty much same advice like here I've posted recently just in different direction.

You need allow rotation on Modal, witch is by default. And disable it on Main controller.

This should work fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜