On Jun 18, 2011, at 6:50 PM, Brian Bruinewoud wrote:

> Actually, that didn't work for me but it did lead me to find a solution.

Cool!

> 
> In my case, the scroll view's contentSize wasn't being updated correctly.
> To fix it I wrote the following (translated to your names) in layoutSubviews:
> 
>       sv.contentSize = v.bounds.size;


Hmm. Not sure why that should be necessary. The contentSize should not *need* 
any updating; you should set it once at the outset, and then when you zoom, the 
zoomable view is transformed and everything just follows as a matter of course. 
The scroll view compensates in accordance with the transform, automatically. I 
don't quite get why you're needing to do this.

> 
> As to why its not being update correctly, I don't know. But this did fix two 
> other issues I was having (and, assuming the issue is in your code too) you 
> should be having- namely, when I zoomed big, the scroll view sometimes 
> wouldn't let me scroll to the portions of the content that were off screen.
> Could you check in your code to see if its the same issue

Well, no, clearly not. If you download and run the project I pointed you to, 
you'll see there's no problem about scrolling to the offscreen portions of the 
image when it's zoomed large. m.



> 
> On 19/06/2011, at 02:05 , Matt Neuburg wrote:
> 
>> On Sun, 12 Jun 2011 14:30:42 +1000, Brian Bruinewoud <br...@darknova.com> 
>> said:
>>> Hi All,
>>> 
>>> I have an app that consists of a scroll view subclass which contains a 
>>> single subview. In the scroll view subclass I override layoutSubviews based 
>>> on Apple sample code (see below). The intention of layoutSubviews is to 
>>> centre the subview in the scrollview when the subview is smaller than the 
>>> scrollview's display area.
>>> 
>>> There are three circumstances where the layoutSubviews is called but in one 
>>> of them the visual results are incorrect.
>> 
>> Funny you should mention this, since I was just experimenting with the same 
>> issue. What I ended up doing is setting the contentOffset explicitly after 
>> the zoomScale changes. 
>> 
>> https://github.com/mattneub/Programming-iOS-4-Book-Examples/tree/master/p492zoomCentered
>> 
>> m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to