Note that there are some explanatory texts on larger screens.

plurals
  1. PORender a single UIImage and rotation has to be applied
    text
    copied!<p>I have rendered few UIImage objects using CGContextDrawImage. But when i apply rotation to the image, it is not applied and the view disappears. <code>code here</code></p> <p>-(void )renderImage: (ItemView *)array {</p> <pre><code> NSArray *selectedImages = self.slideView.selectedView.subviews; CGSize combinedSize = CGSizeMake(0, 0); for (int i = 0; i &lt; [selectedImages count]; ++i) { CGSize sourceSize = [selectedImages[i] size]; NSLog(@"sdfsd %f %f ", sourceSize.width, sourceSize.height); combinedSize.width = MAX(combinedSize.width, sourceSize.width); combinedSize.height += sourceSize.height; } UIGraphicsBeginImageContextWithOptions(self.view.frame.size, NO, 0); CGContextRef context = UIGraphicsGetCurrentContext(); { CGContextTranslateCTM(context, 0, 768); CGContextScaleCTM(context, 1,-1); for (int i = 0; i &lt; [selectedImages count]; ++i) { UIImageView *imageview = selectedImages[i]; UIImage *sourceImage = imageview.image; CGContextSaveGState(context); float radians1 = atan2(imageview.transform.a, imageview.transform.b); CGFloat angle = [(NSNumber *)[imageview valueForKeyPath:@"layer.transform.rotation.z"] floatValue]; printf("\n radians %f",radians1); printf("\n angle %f",angle); CGContextRotateCTM(context, radians(angle)); CGContextDrawImage(context, imageview.frame, imageview.image.CGImage); CGContextRestoreGState(context); //CGContextDrawImage(context, imageview.frame, imageview.image); } } UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(combinedImage, nil, nil, nil); </code></pre> <p>}</p> <p>Thanks,</p> <p>Any help would be appreciated</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload