voltear videos rotar reflejo para imagen illustrator herramienta gratis girar espejo app ios rotation autorotate

videos - ¿Cómo rotar las sub-vistas alrededor de sus propios centros?



herramienta rotar en illustrator (2)

¿Es posible rotar una vista alrededor de su propio centro?

En mi implementación actual, las sub-vistas (botones, etc.) parecen moverse a lo largo de un camino divertido antes de que terminen en las posiciones deseadas (ya que el sistema de coordenadas de la supervista está girado). Me gustaría que las vistas giren 90 grados alrededor de sus propios centros como en la imagen de abajo.


Puede rotar manualmente cualquier subclase UIView utilizando la propiedad de transformación.

#import <QuartzCore/QuartzCore.h> myView.transform = CGAffineTransformMakeRotation(M_PI/2);


Me gusta mucho esta pregunta También encuentro la animación de rotación discordante para algunas interfaces. Así es como implementaría lo que ha imaginado. Una @interface simple estará bien. Nota: Estoy usando ARC.

#import <UIKit/UIKit.h> @interface ControllerWithRotatingButtons : UIViewController @property (strong, nonatomic) IBOutlet UIButton *buttonA; @property (strong, nonatomic) IBOutlet UIButton *buttonB; @property (strong, nonatomic) IBOutlet UIButton *buttonC; @end

Las conexiones de salida apropiadas se realizan a los botones en .xib :

ControllerWithRotatingButtons.m:

#import "ControllerWithRotatingButtons.h" @implementation ControllerWithRotatingButtons @synthesize buttonA = _buttonA; @synthesize buttonB = _buttonB; @synthesize buttonC = _buttonC; -(void)deviceRotated:(NSNotification *)note{ UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; CGFloat rotationAngle = 0; if (orientation == UIDeviceOrientationPortraitUpsideDown) rotationAngle = M_PI; else if (orientation == UIDeviceOrientationLandscapeLeft) rotationAngle = M_PI_2; else if (orientation == UIDeviceOrientationLandscapeRight) rotationAngle = -M_PI_2; [UIView animateWithDuration:0.5 animations:^{ _buttonA.transform = CGAffineTransformMakeRotation(rotationAngle); _buttonB.transform = CGAffineTransformMakeRotation(rotationAngle); _buttonC.transform = CGAffineTransformMakeRotation(rotationAngle); } completion:nil]; } -(void)viewDidLoad{ [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceRotated:) name:UIDeviceOrientationDidChangeNotification object:nil]; } -(void)viewDidUnload{ [super viewDidUnload]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; } -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation == UIInterfaceOrientationPortrait); } @end

Y eso es. Ahora cuando gira el dispositivo, la pantalla no girará, pero los botones se mostrarán como se muestra a continuación:

Por supuesto, si solo quiere que las etiquetas del botón _buttonA.titleLabel , simplemente aplicará la transformación a _buttonA.titleLabel en _buttonA.titleLabel lugar.

Nota: Tenga en cuenta que una vez que se gira el dispositivo por lo que toca a los toques que no están en los botones, el dispositivo todavía está en vertical, pero su respuesta a mi comentario parece indicar que no es un problema para usted.

Siéntase libre de dejar un comentario si tiene una pregunta relacionada.