Yes, scroll views layout during scroll. But the reSl problem is likely in your 
use of device orientation. Specifically unlike interface orientation, not being 
landscape is not the same ad bring portrait, as device orientation has 3 
additional orientations. If you want to match your interface orientation, us 
the interfaceOrientation property on your view controller. 

That said, why layout that way at all? Why not base your layout on the views 
bounds instead?

--
David Duncan @ My iPhone

On Jun 26, 2011, at 11:39 AM, Tales Pinheiro de Andrade <tal...@me.com> wrote:

> Hi.
> 
> I have a few custom views of three kind inside a custom UIScrollview. I'm 
> trying to resize these custom views as the device change the orientation.
> 
> I added these custom views programatically to the custom UIScrollView. I 
> implemented in the custom UIScrollview the below method
> 
> - (void)layoutSubviews {
>    UIDeviceOrientation currentOrientation =  [[UIDevice currentDevice] 
> orientation];
>    if (UIDeviceOrientationIsLandscape(currentOrientation)) {
>        for (id view in [self subviews]) {
>            if ([view isKindOfClass:[ECIndexComponent class]] ||
>                [view isKindOfClass:[ECListComponent class]] ||
>                [view isKindOfClass:[ECGraphView class]]) {
> 
>                CGRect newFrame = [(UIView *)view frame];
>                newFrame.size.width *= 1.5;
>                newFrame.size.height *= 1.5;
>                newFrame.origin.y *= 1.5;
>                [(UIView *)view setFrame:newFrame];
>            }
>        }
>    }
>    else {
>        for (id view in [self subviews]) {
>            if ([view isKindOfClass:[ECIndexComponent class]] ||
>                [view isKindOfClass:[ECListComponent class]] ||
>                [view isKindOfClass:[ECGraphView class]]) {
>                CGRect newFrame = [(UIView *)view frame];
>                newFrame.size.width *= 0.666;
>                newFrame.size.height *= 0.666;
>                newFrame.origin.y *= 0.666;
>                [(UIView *)view setFrame:newFrame];
>            }
>        }
> 
>    }
> }
> 
> And in my view controller shouldAutorotateToInterfaceOrientation method I 
> call setNeedsLayout for the custom scroll view. It's almost there, but now, 
> when I try to scroll, these subviews get redimensioned, even if I did not 
> changed the orientation. It looks like the scrolling is calling layoutSubviews
> 
> Is there a way to correct this?
> 
> Thank you
> _______________________________________________
> 
> 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/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.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