Ich möchte eine 3D-Rotation auf eine Ansicht (insbesondere auf ein UILabel) im iPhone anwenden. Was ist der einfachste Weg dies zu tun?3D-Drehung auf iPhone-Ansicht anwenden
Ein Codebeispiel wird sehr geschätzt.
Ich möchte eine 3D-Rotation auf eine Ansicht (insbesondere auf ein UILabel) im iPhone anwenden. Was ist der einfachste Weg dies zu tun?3D-Drehung auf iPhone-Ansicht anwenden
Ein Codebeispiel wird sehr geschätzt.
Für 2D-Rotation Verwendung:
//rotate label in 45 degrees
label.transform = CGAffineTransformMakeRotation(M_PI/4);
Für 3D-Transformationen siehe this thread:
CATransform3D _3Dt = CATransform3DMakeRotation(radians(90.0f), 1.0, 0.0, 0.0);
// flipping view along axis
// this will rotate view in 3D along any axis
[UIView beginAnimations:nil context:nil];
CATransform3D _3Dt = CATransform3DRotate(self.layer.transform, 3.14, 1.0, 0.0,0.0);
[UIView setAnimationRepeatCount:100];
[UIView setAnimationDuration:0.08];
self.layer.transform=_3Dt;
[UIView commitAnimations];
SWFT 3 Beispiel
let rotationTransform = CATransform3DRotate(myView.layer.transform, CGFloat.pi, 1, 0, 0)
UIView.animate(withDuration: 0.5) {
self.myView.layer.transform = rotationTransform
}
Diese Frage ist zu Ihnen sehr ähnlich: http : //stackoverflow.com/questions/347721/ uiview-perspective-transform –
Danke Brad. Denkst du, ich sollte das löschen? – hpique