【问题标题】:Rotating UIImageView with tap of a button, each way?以每一种方式点击一个按钮来旋转 UIImageView?
【发布时间】:2011-08-27 15:17:34
【问题描述】:

我一直在寻找解决方案..

我想通过点击 a 来旋转 ImageView(每步 45 度) 我希望它可以单向旋转,所以如果我向右点击两步,我希望它能够像往常一样向后点击两步。

谁能帮我提供一些代码、教程、参考资料或文档...?

提前非常感谢你们,你们永远是最棒的!

【问题讨论】:

    标签: objective-c cocoa-touch xcode uiimageview


    【解决方案1】:

    您可以使用CGAffineTransformRotate

    CGAffineTransform transform = imageView.transform;
    
    // Rotate the view 45 degrees (the actual function takes radians)
    transform = CGAffineTransformRotate(transform, (M_PI / 4));
    imageView.transform = transform;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-17
      • 2017-07-08
      • 2014-08-08
      相关资源
      最近更新 更多