iOS ユニバーサル アプリがあり、次のように使用する必要があります。
iPadのLandscapeLeftまたはLandscapeRight
iPhone用ポートレート
たとえば iPad を例にとると、ユーザーのデバイスが縦向きモードの場合でも、アプリを強制的に横向きモードで開く必要があります。アプリがiPad専用で、rakefileがこの設定を使用していた場合、これは問題なく機能していました。
app.interface_orientations = [:landscape_left, : landscape_right]
残念ながら、それが削除された今、アプリはデフォルトで縦向きモードで表示されます。UIViewController.rb の以下のメソッドを上書きして、これを変更しようとしました。これはシミュレーターでは機能しますが、私のデバイスでは機能しません:
def shouldAutorotate
# Block AutoRotation if the interfaces is CORRECT
# Else allow IT
if Device.ipad? # BubbleWrap gem method
if App.shared.interfaceOrientation == UIInterfaceOrientationLandscapeLeft
return false
elsif App.shared.interfaceOrientation == UIInterfaceOrientationLandscapeRight
return false
else
return true
end
elsif Device.iphone?
if App.shared.interfaceOrientation == UIInterfaceOrientationPortrait
return false
else
return true
end
end
end
def viewDidAppear(animated)
# Change the orientation after the view Appeared
if Device.ipad?
App.shared.setStatusBarOrientation(UIInterfaceOrientationLandscapeLeft)
elsif Device.iphone?
App.shared.setStatusBarOrientation(UIInterfaceOrientationPortrait)
end
end
私は多くの解決策を試しましたが、希望どおりに機能するものはありません。
ありがとう、ヴラド