Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tatsuro-ueda/3323755 to your computer and use it in GitHub Desktop.
Save tatsuro-ueda/3323755 to your computer and use it in GitHub Desktop.
UILabelを回転させるには

##How to write text with angle on picture in objective c

Below code rotates the label

- (IBAction)rotate:(id)sender {
    CGContextRef context = UIGraphicsGetCurrentContext();
    [UIView beginAnimations:nil context:context];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(endAnimation)];
    CGAffineTransform rotate = CGAffineTransformMakeRotation(90.0f * (M_PI / 180.0f));
    self.label.transform = rotate;
    
    [UIView commitAnimations];	
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment