• 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: Cody Garvin <email@hidden>
  • Date: Thu, 18 Jul 2013 13:18:16 -0700

Hi Trygve,

The UIScrollView adds these subviews to what's called a contentView. This is why you have to change a content size to adjust your scrolling, vs changing the frame of the UIScrollView. You're grabbing the wrong layer.

You can grab the correct view / layer: [[scrollView contentView] layer];

Hope that helps

- Cody

On Jul 17, 2013, at 8:21 PM, Trygve Inda <email@hidden> wrote:

>> Does it do that even if the scroll view isn't scrolled at all but is at the
>> very top?
>>
>> On 18 Jul, 2013, at 9:56, Trygve Inda <email@hidden> wrote:
>>
>>> I am trying to take a "snapshot" of my UIScrollView and store it in a
>>> UIImage:
>>>
>>> UIGraphicsBeginImageContext(scrollView.bounds.size);
>>> [scrollView.layer renderInContext:UIGraphicsGetCurrentContext()];
>>> UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
>>> UIGraphicsEndImageContext();
>>>
>>>
>>> This works for the most views, but when I try it with the UIScrollView, I
>>> just get a black image (but [image size] is correct).
>>>
>>> Any ideas?
>>>
>>> Trygve
>>>
>
> Yes. It is a right to left full screen scroll view with 3 views in it. I can
> get an image of any of the views with the above code, but not the scroll
> view itself (which may show more than one view)
>
>
>
> _______________________________________________
>
> 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


_______________________________________________

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: Kyle Sluder <email@hidden>
References: 
 >Re: UIScrollView to UIImage (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: NSUndoManager Won't Redo
  • Next by Date: Re: UIScrollView to UIImage
  • Previous by thread: Re: UIScrollView to UIImage
  • Next by thread: Re: UIScrollView to UIImage
  • Index(es):
    • Date
    • Thread