开发者

iphone - presenting an alertview with the right orientation

I have to present an alertview when my app starts. My app supports both landscape modes.

Despite the landscape mode the device is when the app starts the alertview always shows in portrait.

I have tried to use the accelerometer to detect the interface orientation before the orientation notification and I have the correct orientation 2 seconds before the alertview showing.

Then, I use this code to set the status bar to a different orientation, hoping the alertview will fo开发者_开发知识库llow...

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];

or left, depending on the landscape mode.

Nothing works.

Is there a way to force the alertview to respect the orientation?

The point here is this: I cannot set one landscape orientation in particular for the status bar, I have to detect the orientation the device is on and then set the status bar orientation.

thanks for any help.


Is your app using a UITabBarController or a UINavigationController?? Try calling the alert from the rootViewController , which may be a UITabBarController or any other rootController. Dont show the alert from the immediate screen (or subview). Call [alert show] by overriding UITabBarController and from inside it.

i hope I got your problem right

Cheers,

Harikant Jammi

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜