Re: Problem with setNeedsLayout and layoutSubviews in UIScrollView
Re: Problem with setNeedsLayout and layoutSubviews in UIScrollView
- Subject: Re: Problem with setNeedsLayout and layoutSubviews in UIScrollView
- From: Tales Pinheiro de Andrade <email@hidden>
- Date: Tue, 28 Jun 2011 22:59:18 -0300
Em 27/06/2011, às 13:56, David Duncan escreveu:
>
> The problem is that a UIDeviceOrientaiton also includes Unknown, FaceUp and FaceDown orientations. Thus !Landscape means Portrait or one of those (ditto for !Portrait). A large portion of the time, your likely holding the device in FaceUp orientation as far as UIDeviceOrientation is concerned, and thus failing your Landscape check.
All right, I didn't know about FaceUp and FaceDow. Now makes sense
>
>> So, if scroll view layout during scroll, I cannot do this resizing in layoutSubview, and should do this in shouldAutorotateToInterfaceOrientation method in my controller?
>
> No, you would use -willAnimateAutorotationToInterfaceOrientation:duration: to do your layout. But at a higher level, why layout based on orientation in the first place? Unless you have specific elements that should not appear in one orientation or another (which doesn't seem to be the case from your code) why not just layout based on the size of the containing view? You can locally determine if it is a portrait or landscape view by comparing width & height in many cases.
I'm doing this because autoresizingMask wasn't working correctly. I have in this scroll view (planed to be visualized mainly in portrait, but also in landscape) a view that width > height. If I put just UIVireAutoResiningFlexibleHeight | UIVireAutoResiningFlexibleWidth, the view get the right size in horizontal , but is compressed in vertical (as when I put in landscape, the proportion of dimensions change). And if I used just UIVireAutoResiningFlexibleWidth, the subcomponents get not proportionally re dimensioned.
I have implemented in shouldAutorotateToInterfaceOrientation and it worked, but I will change to willAnimateToInterfaceOrientation:duration: as you proposed.
Thank you
>
> --
> David Duncan
>
_______________________________________________
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