首页 > 解决方案 > 如何在 Xamarin 的 ImageView 中设置图像的旋转角度?

问题描述

我正在使用 Xamarin.iOS,现在我想在单击按钮时在 ImageView 中将图像旋转 90 度。我发现了一个类似的问题。但它是用 OC 和 Swift 编写的。如何在 C# 中实现它?我找不到之类的方法CGAffineTransformMakeRotation

标签: xamarinxamarin.ios

解决方案


在 Xamarin 中它是CGAffineTransform.MakeRotation

using CoreGraphics;

// 1.5708 is 90 degrees in Radians
myImageView.Transform = CGAffineTransform.MakeRotation(1.5708f);

推荐阅读