Re: UIScrollView to UIImage

2013-07-28 Thread David Duncan
The scroll view's bounds.origin is also its contentOffset, which is likely what is happening when you render it in to the context. However, you seem to imply that you just have a simple scroll view with a simple image inside – why do this at all? Instead just use the contentOffset to determine

Re: UIScrollView to UIImage

2013-07-28 Thread Trygve Inda
Update: CGRect rect = [scrollView bounds]; UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); [scrollView.layer renderInContext:context]; UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext()

Re: UIScrollView to UIImage

2013-07-21 Thread Cody Garvin
Hi Trygve, sorry for the misinformation earlier. I wanted to follow up and let you know this is indeed working for me. Forgot to follow up Friday, so sending today. A few things. A) Are you adding the QuartzCore framework to your project (I don't believe you'd be able to compile if you weren'

Re: UIScrollView to UIImage

2013-07-19 Thread Cody Garvin
You're right Kyle. I quickly tried it, saw it worked and moved on. I'll try it again another way and report back Please excuse mobile typos On Jul 18, 2013, at 1:37 PM, Kyle Sluder wrote: > On Thu, Jul 18, 2013, at 01:18 PM, Cody Garvin wrote: >> The UIScrollView adds these subviews to what's

Re: UIScrollView to UIImage

2013-07-18 Thread Kyle Sluder
On Thu, Jul 18, 2013, at 01:18 PM, Cody Garvin wrote: > 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. When learning about A

Re: UIScrollView to UIImage

2013-07-18 Thread Cody Garvin
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] la

Re: UIScrollView to UIImage

2013-07-17 Thread Trygve Inda
> 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 wrote: > >> I am trying to take a "snapshot" of my UIScrollView and store it in a >> UIImage: >> >> UIGraphicsBeginImageContext(scrollView.bounds.size); >> [scrol

Re: UIScrollView to UIImage

2013-07-17 Thread Roland King
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 wrote: > I am trying to take a "snapshot" of my UIScrollView and store it in a > UIImage: > > UIGraphicsBeginImageContext(scrollView.bounds.size); > [scrollView.layer re

UIScrollView to UIImage

2013-07-17 Thread Trygve Inda
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 wo