Bir UIImage'ı döndürüyorum Bir ölçek değerine göre. Ölçekim ve Rotasyon iyi çalışıyor ancak sorun uiimage döndükten sonra, görüntü boyutu (genişlik & Yükseklik) azalıyor . Sorunu çözmek için herhangi bir fikrin var mı? Image before RotationUIImage boyutu (width & Height) döndürüldükten sonra azalıyor
kod i kullanıyorum
:
UIView *rotatedViewBox = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.image.size.width, self.image.size.height)];
CGAffineTransform t = CGAffineTransformMakeRotation(self.lastContentOffset/5);
rotatedViewBox.transform = t;
CGSize rotatedSize = rotatedViewBox.frame.size;
// Create the bitmap context
UIGraphicsBeginImageContext(rotatedSize);
CGContextRef bitmap = UIGraphicsGetCurrentContext();
// Move the origin to the middle of the image so we will rotate and scale around the center.
CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2);
// // Rotate the image context
CGContextRotateCTM(bitmap, 5.0);
// Now, draw the rotated/scaled image into the context
CGContextScaleCTM(bitmap, 1.0, -1.0);
CGContextDrawImage(bitmap, CGRectMake(-self.image.size.width/2 , -self.image.size.height/2 , self.image.size.width, self.image.size.height), \[self.rotatedImage CGImage\]);
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.rotatedImage = newImage;
Teşekkürler arkadaşım, bağlam boyutunu değiştirdim, işe yaradı @ s0urcer –