Re: layoutSubviews doesn't always work (iOS 4.3 on iPad Simulator)
Re: layoutSubviews doesn't always work (iOS 4.3 on iPad Simulator)
- Subject: Re: layoutSubviews doesn't always work (iOS 4.3 on iPad Simulator)
- From: Brian Bruinewoud <email@hidden>
- Date: Sun, 19 Jun 2011 11:50:10 +1000
Matt,
Thanks for your response.
Actually, that didn't work for me but it did lead me to find a solution.
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;
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 - at least that will suggest some kind of bug in the frameworks/documentation rather than my code :)
Thanks,
Brian.
On 19/06/2011, at 02:05 , Matt Neuburg wrote:
> On Sun, 12 Jun 2011 14:30:42 +1000, Brian Bruinewoud <email@hidden> 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 = email@hidden, <http://www.apeth.net/matt/>
> A fool + a tool + an autorelease pool = cool!
> Programming iOS 4!
> http://www.apeth.net/matt/default.html#iosbook
_______________________________________________
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