我想在旋转父视图时旋转具有相同角度的子视图。我如何实现这一目标?
- (void)rotationDetected:(UIRotationGestureRecognizer *)rotationRecognizer {
rotationRecognizer.rotation = M_PI_4;
CGFloat angle = rotationRecognizer.rotation;
duplicateView.transform = CGAffineTransformRotate(duplicateView.transform, angle);
userView.transform = duplicateView.transform;
rotationRecognizer.rotation = 0.0;
}
答案 0 :(得分:0)
如果旋转UIView
的父视图,子视图也将以相同的方式旋转。您不必编写任何特殊代码来实现这一目标。