我想从UIRotationGestureRecognizer中反转特定子视图的旋转。我的旋转发生在90度阶段(所以CGFloat.pi / 2)
func localhandleRotateGesture (localrotateGesture: UIRotationGestureRecognizer) {
if localrotateGesture.state == .ended {
if localrotateGesture.rotation > 0.0005{
localrotateGesture.view?.transform = (localrotateGesture.view?.transform)!.rotated(by: CGFloat.pi / 2)
}
localrotateGesture.rotation = 0
}
工作正常。然后我访问子视图并尝试反转运动
var thisCell = localrotateGesture.view as! CustomMessageCell
thisCell.cellButtonsStackView.transform = (localrotateGesture.view?.transform.inverted())!.rotated(by: CGFloat.pi / 2)
子视图会旋转第一次尝试,之后就不会了!发生了什么事?