LoginSignup
0
0

More than 5 years have passed since last update.

UIImageの回転

Posted at

UIImageの回転

_imageOriginal = [UIImage imageNamed:@"購入記録no1.png"];

UIGraphicsBeginImageContextWithOptions(CGSizeMake(_imageOriginal.size.height, _imageOriginal.size.width), YES, _imageOriginal.scale);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, _imageOriginal.size.height, _imageOriginal.size.width);
CGContextScaleCTM(context, 1, -1);
CGContextRotateCTM(context, M_PI_2);

CGImageRef      imgRef = [_imageOriginal CGImage];
CGContextDrawImage(context, CGRectMake(0, 0, _imageOriginal.size.width, _imageOriginal.size.height), imgRef);
_imageRotation = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0