• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UIScrollView to UIImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UIScrollView to UIImage


  • Subject: Re: UIScrollView to UIImage
  • From: Trygve Inda <email@hidden>
  • Date: Sun, 28 Jul 2013 08:31:28 -0700
  • Thread-topic: UIScrollView to UIImage

Update:

CGRect rect = [scrollView bounds];
UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
[scrollView.layer renderInContext:context];
UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();


The scroll view is full screen (768w x 955h) and the image in the scrollview
is 1500w x 955h so it can only scroll right-left.

If I run this code with the scrollview scrolled all the way to the left,
everything is fine. The resulting image is the leftmost chuck of the image
in the scroillview.

However if I scroll the scrollview 100 pixels to the left (so the scrollview
has 100 pixels off the left edge of the screen, 768 pixels on screen and 632
pixels off the right edge of the screen)....


The resulting image from the above code has 100 pixels of black on the left
side, and then the correct image for the rest of it.

Changing the first line to:

CGRect rect = [scrollView frame];

produces the exact same result. So somehow, the above code can't handle when
the scrollview is scrolled away from 0,0.

How can I fix this?




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: UIScrollView to UIImage
      • From: David Duncan <email@hidden>
References: 
 >Re: UIScrollView to UIImage (From: Cody Garvin <email@hidden>)

  • Prev by Date: Re: when __bridge isn't required
  • Next by Date: Button on side menu not working
  • Previous by thread: Re: UIScrollView to UIImage
  • Next by thread: Re: UIScrollView to UIImage
  • Index(es):
    • Date
    • Thread