小编Mar*_*yer的帖子

尝试使用变换在MonoTouch中旋转UIView

我定义了一个UIControl,在其中使用MonoTouch.CoreGraphics类在其中绘制了一些项目,并已通过AddSubview将UIControl放入UIView中。我正在尝试查看并旋转整个过程,以模拟某种类似于分针或秒针在时钟或表盘上的运动。我的印象是,我可以使用UIView上的Transform来做到这一点。

我的UIView的名称是容器。我试过了:

    container.Transform.Rotate(-0.78f);
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

    CGAffineTransform t = CGAffineTransform.MakeIdentity();
    t.Rotate(-0.78f);
    container.Transform = t;
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

    CGAffineTransform t = CGAffineTransform.MakeRotation(-0.78f);
    container.Transform = t;
Run Code Online (Sandbox Code Playgroud)

我也尝试过这个和它的其他组合:

    UIView.BeginAnimations("rotate");
    UIView.SetAnimationDuration(0.5);
    container.Transform.Rotate((float)Math.PI);
    UIView.CommitAnimations();
Run Code Online (Sandbox Code Playgroud)

以上都不对我的显示器有任何影响。丝毫不会旋转或移动。所有与iOS相关的帖子都引用了CGAffineTransformRotate,但我找不到与之完全匹配的Mono,并假设这与我在上面所做的等同。我还有其他方法可以尝试使视图旋转吗?

transform core-graphics rotation xamarin.ios cgaffinetransform

5
推荐指数
1
解决办法
4768
查看次数