简体   繁体   English

iphone设备方向

[英]iphone device orientation

During inAppPurchase, the storeKit will ask the username and password 在inAppPurchase期间,storeKit将询问用户名和密码

even though i set... 即使我设置......

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];

It ask Username and password in Portrait Mode... In general How to solve this kind of issue . 它在纵向模式下询问用户名和密码... 一般如何解决此类问题

UPDATED : But the InAppPurchase message on successful purchase is coming in landscape mode. 更新:但成功购买的InAppPurchase消息将以横向模式进行。

Thanks in advance, 提前致谢,

As of 3.2 you cannot change the orientation of a running application from code. 从3.2开始,您无法从代码更改正在运行的应用程序的方向。

But you can start an application with a fixed orientation, although doing so this is not straightforward. 但您可以使用固定方向启动应用程序,但这样做并不简单。

Try with this recipe: 试试这个食谱:

  1. set your orientation to UISupportedInterfaceOrientations in the Info.plist file 将您的方向设置为Info.plist文件中的UISupportedInterfaceOrientations
  2. in your window define a 480x320 "base view" every other view will be added to 在您的窗口中定义一个480x320“基本视图”,每个其他视图将被添加到
  3. in all view controllers set up the shouldAutorotateToInterfaceOrientation: method (to return the same value you defined in the plist, of course) 在所有视图控制器中设置shouldAutorotateToInterfaceOrientation:方法(返回你在plist中定义的相同值,当然)
  4. in all view controllers set a background view with 在所有视图控制器中设置背景视图

    self.view.frame = CGRectMake(0, 0, 480, 320)

    in the viewDidLoad method that should do the trick. viewDidLoad方法中应该做的伎俩。

References: 参考文献:

您是否尝试过使用Info.plist设置整个应用程序?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM