UIRotationGesture 后重置视图 [英] Reset view after UIRotationGesture
本文介绍了UIRotationGesture 后重置视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 UIImageView 上有一个 UIRotationRecognizer.旋转视图后,我想提交更改,以便下次旋转图像时它会自然旋转.目前,使用下面的代码,在释放触摸并尝试再次旋转后,原点似乎是关闭的.
I have a UIRotationRecognizer on an UIImageView. After I rotate the view I would like to commit the changes so that next time I rotate the image it rotates naturally. Currently, with the code below, it looks like the origin is off after release the touch and try to rotate again.
[Export("RotationSelector")]
private void RotationSelector(UIRotationGestureRecognizer recognizer)
{
recognizer.View.Transform = CGAffineTransform.MakeRotation(recognizer.Rotation);
if (recognizer.State == UIGestureRecognizerState.Ended)
// Reset origin here...
}
谢谢
推荐答案
你需要像这样重置你的转换:
You need to reset your transformation like this:
recognizer.View.Transform = CGAffineTransform.MakeIdentity();
这篇关于UIRotationGesture 后重置视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文