xamarin forms restrict app's supported orientations - xamarin

I am developing a xamarin forms app and I want to restrict the app's supported orientation to be Portrait only. I have indicated so in the info.plist file. But, the app still rotates when I rotate the device / simulator. What am I missing ?

This seems to be a bug in Xamarin Studio in that the GUI checkboxes only affect orientation for iPhone, not iPad. I will get a bug report filed, but in the meantime just view the Source for the Info.plist (Click the Source tab at the bottom of the Info.plist document and look for Supported interface orientations (iPad) which contains an array of values. Delete all of the values except Portrait (bottom button) from the array for Supported interface orientations (iPad)
UPDATE: Bug filed: https://bugzilla.xamarin.com/show_bug.cgi?id=50552

Related

Swift - Problems with layout

I have a Universal application in Swift 2.0 developed in XCode 7.
On the storyboard simulated metrics, I have the 'size' set to 'iPhone 4.7-inch'.
When I run the application on my device (iPhone 5s), none of the labels are aligned and the toolbar is out of view. -This is also the case when I run using the iPad device in XCodes simulator.
Image of what the view controller contains ...
From the snippet above, when I run this VC on my iPhone there is no margin on the right side, and the toolbar is cropped off.
Can anyone advise how I can make a universal application show all the content in the VC, on all devices. Or how I would simply show the toolbar ...
That's what auto layout (constraints) is for.
On the storyboard simulated metrics, I have the 'size' set to 'iPhone 4.7-inch'.
That's irrelevant, and indeed misleading, since in means that only on the iPhone 4.7-inch will your app look like the storyboard design — unless you use auto layout.
iPhones come in many screen sizes. Basically, you have no way of knowing, as you design, what the screen size will actually be! Auto layout is the solution. Auto layout allows your interface elements to adjust automatically as the app launches on a particular size screen. iPads can serve as an extension of this — i.e., just an even larger size screen — or you can even use conditional constraints to make the interface quite different on the iPad from the iPhone, if desired - all designed in a single storyboard.
Maybe you are using auto layout and auto constraint. You could deactivate this in opening the storyboard, open up right panel , go to "show the file inspector" section and under Interface Builder Document uncheck auto layout and auto constraint
Image here
Select your item view, go into "Show the size inspector" and there you can set your autoresizing for all devices

iOS simulator is inconsistant to the preview in Xcode?

I choose 4.7-inch as the default layout in Storyboard to make prototype more easily. 4.7-inch is iPhone 6 according to this link on Apple website.
In Xcode Preview, it's ok to show the layout.
But in iPhone 6 simulator, the layout is inconsistent to Preview.
Is it a bug in Xcode's Preview? Thanks.
FYI, Auto Layout and Size Classes are enabled, but I haven't add any constraint yet.
If constraints are enabled in your storyboard, then add constraints to it to be sure your layout behaves as you expect !

How to make xcode ios app not view vertically

so, i have an ios app and i have built it with interface builder and xcode. I built it using interface builder in the horizontal view because that is how i want my app. I have also made the supported views landscape left and right and i have edited info.plist to make it open horizontally.
But when i build and go it opens in iphone simulator horizontally but it shows as it would if it was vertical.
here's some screenshots:
what i want it to look like:
http://www.sendspace.com/file/4ct4b0
what it actually looks like:
http://www.sendspace.com/file/fayjqj
how could i get it to open like i want??
You have to allow the orientation also in your implementation of UIViewController using shouldAutorotateToInterfaceOrientation :
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation {
return YES; //or UIInterfaceOrientationIsLandscape(interfaceOrientation) for just landscape
}
Also, if you have some more problems look on linked SO questions to this "out-dated" question:
iPhone app in landscape mode, 2008 systems

How can I lock orientation in OpenPlug (/flex)?

I'm writing program with Flex using OpenPlug. I'm having difficulties locking the devices orientation. From Project Properties I can find OpenPlug Studio Targeted Devices and their options. For iOS there is options to support (or not) different orientations and for Android / Symbian there is none.
Even if I select to support only "portrait" orientation with iOS, in emulator screen is not locked. I can't try it in real device, because I'm not able to generate XCode. There's another problem. I have selected to generate XCode, I've selected Apple - iPhone as device and I have selected target folder. When I click build-button, nothing happens..?
Any info regarding either one problem will be appreciated! :)
Not shure if this is still relevant - in OpenPlug Studio, you right-click on the project and choose "Properties". You then choose "OpenPlug Studio targeted Devices" on the left side in order to get the list of devices. You now click the button "Edit by Platform" on the upper right corner. This will render you a list of settings you can make. Among others, there are items "iPhone Support Landscape Left Orientation", "iPhone Support Landscape Portrait Orientation" and so on. Setting these should do the job of locking the orientation.
I have no idea what OpenPlug is, but it looks like an IDE, but I'm not sure. Frankly, it shouldn't matter. If you have a Flex project, you should have an application descriptor file (an xml under the source directory). Under that, there should be an 2 tags that you should be interested in:
<aspectRatio><!-- set portrait or landscape here --></aspectRatio>
<autoOrients>false</autoOrients>

How to make an iOS app support landscape orientation in XCode?

How to make an iOS app support landscape orientation?
How do you make it support both landscape and portrait, where you can just press a button to activate it.
for any new people reading this old post just go to main.storyboard->click on the view controller click on simulated metrics (the fourth icon that pops up, looks kind of like a pentagon belt buckle)
then orientation->Landscape this is for Xcode 5

Resources