Re: UIScrollView to UIImage
Re: UIScrollView to UIImage
- Subject: Re: UIScrollView to UIImage
- From: Cody Garvin <email@hidden>
- Date: Fri, 19 Jul 2013 13:14:34 -0700
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 <email@hidden> wrote:
> 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 Auto Layout on iOS, I spent a lot of time exploring
> the internals of UIScrollView. My investigations led me to conclude that
> there is no such thing as a content view as you describe it. You can see
> this for yourself if you call -recursiveDescription on your scroll view
> (or any of its ancestors).
>
> It looks to me like the initial design of UIScrollView—that is, before
> the iOS 2.0 SDK ever shipped—was similar to that of NSScrollView on the
> Mac. This is why the documentation makes references to "content views."
>
> At some point before iOS 2.0, this design was changed, and the area
> scrolled by the scroll view no longer maps to an actual UIView object.
> This is why UITableView and friends are _subclasses_ of UIScrollView,
> rather than _subviews_.
>
> The _contentView ivar, and the private -contentView method, now seem to
> exist for the purpose of supporting
> -touchesShouldBegin:withEvent:inContentView: and friends. There is no
> secret "content view" in the view hierarchy.
>
> Again, this understanding is derived from poking at UIScrollView's
> internals. It is not definitive, and quite likely not (entirely)
> correct. But it jibes with my understand of UIScrollView much better
> than the "anonymous contentView" theory.
>
>> You can grab the correct view / layer: [[scrollView contentView] layer];
>
> There is no public -contentView method on UIScrollView, so attempting to
> call it is likely to get your app rejected by the App Store. Please do
> not use this method.
>
> --Kyle Sluder
_______________________________________________
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