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: Sun, 26 Jun 2011 16:51:45 -0300
Well, I used the macro UIDeviceOrientationIsLandscape, I'm assuming that this is for both sides:
#define UIDeviceOrientationIsPortrait(orientation) ((orientation) == UIDeviceOrientationPortrait || (orientation) == UIDeviceOrientationPortraitUpsideDown)
#define UIDeviceOrientationIsLandscape(orientation) ((orientation) == UIDeviceOrientationLandscapeLeft || (orientation) == UIDeviceOrientationLandscapeRight)
So the else only occours when the device is in portrait (being normal or upside down), right?
So, if scroll view layout during scroll, I cannot do this resizing in layoutSubview, and should do this in shouldAutorotateToInterfaceOrientation method in my controller?
Em 26/06/2011, às 16:07, David Duncan escreveu:
> 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 <email@hidden> 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]] ||
_______________________________________________
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