On Jun 26, 2011, at 12:51 PM, Tales Pinheiro de Andrade wrote: > 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?
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. > 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. -- David Duncan _______________________________________________ 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