旋转不适用于UIButton中的ImageView

所以首先我将UIButton子类化。值得一提的是,如果我将旋转应用于其起作用的UIButton。但是,当我将其应用于UIImageView时,根本没有旋转。因此,处理动画的代码如下。

    private float RotationAngle { get; set; } = (float)Math.PI / 2;

    private void SpinWithOptions(UIViewAnimationOptions animationOptions)
    {
        Animate(0.5,animationOptions,() => {

            // Animation
            ImageView.Transform = CGAffineTransform.Rotate(ImageView.Transform,RotationAngle);
        },() => {

            // Completion
            if (Animating)
            {
                SpinWithOptions(UIViewAnimationOptions.CurveLinear);
            }
            else if (animationOptions != UIViewAnimationOptions.CurveEaseOut)
            {
                        SpinWithOptions(UIViewAnimationOptions.CurveEaseOut);
            }
        });
     } 

我唯一要做的就是像这样设置拐角半径。

Layer.CornerRadius = Bounds.Size.Width / 2;

我无法理解为什么将其应用于UIButtons Transfrom但不适用于UIImageView时为何起作用

LiJ86 回答:旋转不适用于UIButton中的ImageView

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3115984.html

大家都在问