ios - Changing device orientation settings by Device in Rubymotion -
i have universal app using rubymotion, , ui setup differs between iphone version , ipad version.
the main being, in iphone supports portrait, , ipad supports landscape.
i want this, if possible setting on rakefile, understand alternative in delagate method, if possible set orientation settings in settings file.
motion::project::app.setup |app| #app settings app.name = 'xxxxx' app.version = "0.xxxx" app.device_family = [:iphone, :ipad] app.interface_orientations = [:portrait] end
edit:
some updates on how jamon's answer worked out. having shouldautorotate return false in uinavigation resulted in odd occurrences on ipad version, having parts of ipad version show view content portrait though orientation set landscape, worked out when returned true shouldautorotate.
you won't able in rakefile, far know. need specify provide both orientations , programmatically tell ios whether orientation supported or not.
your uiviewcontrollers and/or uinavigationcontroller(s) should this:
def ipad? nsbundle.mainbundle.infodictionary["uidevicefamily"].include?("2") end def shouldautorotate false # think? end def supportedinterfaceorientations if ipad? uiinterfaceorientationmasklandscapeleft | uiinterfaceorientationmasklandscaperight else uiinterfaceorientationmaskportrait end end def preferredinterfaceorientationforpresentation ipad? ? uiinterfaceorientationmasklandscapeleft : uiinterfaceorientationmaskportrait end
haven't tested code, i've used similar in past. can use ternary (like did in last method) or regular if
.
Comments
Post a Comment