Note that there are some explanatory texts on larger screens.

plurals
  1. POShare A High Resolution Image
    text
    copied!<p>Here's my code:</p> <pre><code> - (void)shareButtonTapped { CGSize newImageSize = CGSizeMake(850.0, 850.0); UIGraphicsBeginImageContextWithOptions(newImageSize, YES, _aImageView.image.scale); [self.aImageView.layer renderInContext:UIGraphicsGetCurrentContext()]; [self.aImageView.image drawInRect:CGRectMake(0, 0, newImageSize.width, newImageSize.height)]; UIImage * image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // UIActivityViewController code here } </code></pre> <p>Right now if I tap on the Mail button, for example, the image is the newImageSize, but my _aImageView.image is only displayed in the top left corner while the rest of the image is solid black.</p> <p>How do I edit this code to scale the image to the 850 x 850 or to a high resolution size so it will look sharp when shared via Email or Social Media?</p> <p>Thanks! </p> <p>EDIT <strong>*</strong></p> <p>Still stuck. I feel like I am almost there.</p> <p>Here's my new code:</p> <pre><code> - (void)shareButtonTapped { _topBarImageView.hidden = YES; _bottomBarImageView.hidden = YES; CGSize newImageSize = CGSizeMake(600.0, 600.0); UIGraphicsBeginImageContextWithOptions(newImageSize, YES, _aImageView.image.scale); [_aImageView.layer = renderInContext:UIGraphicsGetCurrentContext()]; [_aLabel drawTextInRect:CGRectMake(20, 250, 280, 140)]; UIImage * image = UIGraphicsGetImageFromCurrentImageContext(); UIImage * newImage = [UIImage imageWithImage:image scaledToSize:newImageSize]; UIGraphicsEndImageContext(); _topBarImageView.hidden = NO; _bottomBarImageView.hidden = NO; // Share Code } </code></pre> <p>So I'm hiding a couple of custom imageViews that are on this screen. The only thing I want shared is the aImageView and the aLabel.</p> <p>Right now when I open my email for example, I can see the newImageSize, but the majority of the box is still black. I still can't figure out what I am missing. </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