旋转我正在尝试将我的图像旋转 90 度。它在没有旋转的情况下工作,但是当我旋转和平移时它不显示。我究竟做错了什么?
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"check" ofType:@"jpg"];
UIImage *newImage = [[UIImage alloc] initWithContentsOfFile:filePath];
UIGraphicsBeginImageContext(newImage.size);
//CGContextRef c = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), newImage.size.width, 0);
//CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0, newImage.size.width);
//CGContextScaleCTM(UIGraphicsGetCurrentContext(), 1.0, -1.0);
CGContextRotateCTM(UIGraphicsGetCurrentContext(), 90);
CGRect imageRect = CGRectMake(0, 0, newImage.size.height, newImage.size.width);
CGContextDrawImage(UIGraphicsGetCurrentContext(), imageRect, newImage.CGImage);
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
ImageView.image = viewImage;