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/archive%40mail-archive.com This email sent to arch...@mail-archive.com