Rotate UIView around its center keeping its size

前端 未结 10 1158
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 14:17

I\'m trying to rotate an UIView a few radians but after applying the transformation it doesn\'t look to be keeping its size. What\'s the proper way to achieve t

10条回答
  •  被撕碎了的回忆
    2020-12-02 14:55

    Try with this code:

    #define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)
    
    double rads = DEGREES_TO_RADIANS(240);
    self.arrowView.layer.transform = CATransform3DMakeRotation(rads, 0, 0, 1);
    

提交回复
热议问题