Sir,

Not sure I understand the problem... the user determines the orientation of the device... all (I think) we can/should do is respond to whatever orientation is when we launch and when notified of changes...

To "force" the device, have you looked at - (BOOL)shouldAutoRotateToInterfaceOrientation...... ? For example, this can be used to "force" a landscape layout when the device is held in or moved into portrait orientation.

I use the free built-in Xcode documentation and examples, don't know about the Wrox book, but it does not look like it is adding anything worthwhile to the knowledge base.

Gary

On Oct 13, 2010, at 7:16 PM, William Squires wrote:

Hi
What's the proper way to force an iOS device to set the orientation to one of

UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown

?

The (relatively new) Wrox book says to do something along the lines of

[[UIDevice currentDevice] setOrientation:<one of the orientation constants above>];

but both the documentation and the compiler say no. The documentation states that 'orientation' is a readonly property of the UIDevice class, and the compiler confirms this with a warning that "UIDevice may not respond to 'setOrientation:'"

I know you can set the initial orientation in the viewDidLoad method, but that technique doesn't quite work anywhere else - it'll set the orientation all right, but the view itself won't act as if that's the orientation in use... at least on the iPad simulator; haven't tried uploading it to my iPad yet.

So what is the correct way of programmatically setting the interface orientation in iOS devices?

_______________________________________________

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/toothpic%40fastq.com

This email sent to tooth...@fastq.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