开发者

Is there a way to do rotation in UIViewController without animation?

开发者 https://www.devze.com 2023-01-11 21:54 出处:网络
Is there a way to enable rotation but without the anima开发者_C百科tion as you turn the device from portrait to landscape?

Is there a way to enable rotation but without the anima开发者_C百科tion as you turn the device from portrait to landscape?

I'm looking at:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

... but I don't see how I can set the "duration" property to 0 and thus eliminate the animation. Perhaps there is a better way?

Thanks


You can use the transform property of a UIView to rotate your view immediately :

CGAffineTransform trans = CGAffineTransformMakeRotation(180.0);
yourView.transform = trans;

Hope it will help.

More information available here

0

精彩评论

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