rotateJ'essaie de faire pivoter mes images de 90 degrés. Cela fonctionne sans la rotation, mais quand je tourne et traduit il ne montre pas. Qu'est-ce que je fais mal?L'image ne tourne pas correctement
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;
vérifier cette autre question http://stackoverflow.com/questions./10307521/ios-png-image-pivoté-90 degrés – tkanzakic
CGContextRotateCTM utilise l'angle en radians .. donc M_PI_2 pour 90 degrés –