I just made an ios app through cordova, iphone app looks fine because I am using always portrait mode for iphones but for ipads I am using always landscape mode with locked rotation. The problem is when I ma build an app and run it on my ipad the landscape works fine the rotation is locked but the main issue is that I have set 100% height on body, and somehow its not working on iPad landscape. Looks like that 100% doesnt detect landscape mode and automatically was set 1024px for height because if I am set 768px height for body in inspect then the whole app looks fine as should.
Any ideas what can be the issue there ?
Don't set width and height if you set the scale
From apple doc
You do not need to set every viewport property. If only a subset of
the properties are set, then Safari on iOS infers the other values.
For example, if you set the scale to 1.0, Safari assumes the width is
device-width in portrait and device-height in landscape orientation.
Related
I am writing an application that runs on Android TV 5.1 or newer that uses the WebView as the display rendering engine. I am able to set the desired display orientation, but the WebView rotates back to landscape within the display and maintains the correct aspect ratio.
I have tried using CSS to perform a transform but the aspect ratio is not correct. I have not found a method to force the WebView to rotate and fit the parent window.
Is there any method to set the orientation and size of the WebView itself? I see the same behavior on multiple devices.
This behavior is device specific. Some of the devices I have tested rotate as expected, another device rotates the display, but the WebView rotates back into landscape. The remaining devices I have tested do not rotate at all.
I will make this will be a known limitation of running this application on Android TV devices.
I have some troubles with the LaunchScreen.storyboard.
My app is a Universal App, default orientation is portrait but landscape is also allowed.
My LaunchScreen is very simple.
A UILabel with 2 constraints :
Align leading to Safe Area (with constant = 30)
Top space to Safe Area (with constant = 30)
When I check my LaunchScreen inside XCode with simulated traits (iPhone XR, iPad, Landscape, Portrait…) everything looks fine.
When I launch the app in portrait orientation everything looks fine.
Then I turn the simulator (or real device) to landscape and re-run the app.
This time the UILabel doesn't respect it's constraints. The label is touching the black notch and the top space seems twice the defined size.
Do you have the same problem ? How can I fix it ?
Apple describes this in their documentation as follows:
At launch time, apps should always set up their interface in a portrait orientation. After the application(_:didFinishLaunchingWithOptions:) method returns, the app uses the view controller rotation mechanism described above to rotate the views to the appropriate orientation prior to showing the window.
So I believe the behaviour you're after isn't particularly supported by Apple I'm afraid. As a side note, I'm not entirely sure how they support it on iPads.
Apply constraints to your UILabel as per my below screenshot :-
Also, in your project Target set Deployment Info :-
If you want to change UILabel frame, then ask me.
I have an application which supports both aspect ratio i.e LANDSCAPE and PORTRAIT. For some of the screen I need to set the orientation to PORTRAIT ONLY. To achieve this I have used :
stage.setAspectRatio(StageAspectRatio.PORTRAIT);
This change the orientation of application to portrait correctly and lock the orientation in portrait mode and is working correctly as per the requirement. Now when this code is used though application's aspect ratio is changed to portrait, but status bar orientation remain in LANDSCAPE mode.
Due to this when softkeyboard is opened it is opened in incorrect orientation. Please see image below:
Application behavior on ios 8+ after changing aspect ratio
Below is code from descriptor file :
<aspectRatio>any</aspectRatio>
<renderMode>auto</renderMode>
<autoOrients>true</autoOrients>
<fullScreen>true</fullScreen>
<visible>true</visible>
<softKeyboardBehavior>none</softKeyboardBehavior>
This issue is not observed when running on ios version lower than 8. I am using flex 4.14.1 and AIR 19.0 version.
I had also tried setting the autoOrients to false in descriptor file and stage.autoOrients = true before changing the aspect ratio, but nothing has worked for me.
Any help on this will be great for me to proceed.
I'm using a ListView in Xamarin.Forms. I have a problem with the resizing of the rows. When I start my application on portrait mode, the width of the rows fill the screen (as intended), but when I rotate to landscape mode they become wider. So far so good, but when I switch back to portrait again the rows stays the width as they were on landscape mode. This behaviour is not seen on an Android application with exactly the same code.
I've only tested this on the iOS simulator so far. It has the same behaviour on the iPad and the iPhone simulator.
Have I encountered a bug?
I'm working on Today extension widget in iOS8 using Xcode beta 6.
I set the frame of my widget by setPreferredContentSize: in viewWillAppear:
It works nicely in all iOS devices except on the landscape iPhones.
On the iPhones in landscape mode, height of widget becomes no more than 166px(in retina iPhone, 332px). And I am trying to set it about 300px.
I understand tall widget might be bad as Apple mentioned in the App Extension Programming Guide, but sometimes Calendar app become very tall if there's many schedules.
Since I have no iOS8 iPhone, I've tested only with simulators.
Is it a simulator's bug?
Any advice will be appreciated.
The maximum height of a NC Widget is not documented by Apple.
However, in my experience, the maximum height is strictly the height of the screen minus the controls on the top and bottom.
This has the undesired effect that a widget that fits nicely on an iPad or an iPhone 6 plus may not fit on an iPhone in landscape!
This is the case on devices as well as the iOS Simulator (as of iOS 8.1.2)
In an app I'm writing, the NC widget's preferredContentSize.height is always 210 pt. However, in landscape on an iPhone 5, the widget height is capped at 205.5 pt. So UI elements are packed tighter together.
I've seen some NC Widgets which display UITableViews with a fixed number of rows, which works fine on an iPad or portrait iPhone but gets clipped on landscape iPhone.
In cases like this, you may want to optimistically set the preferredContentSize to the height you want, then check the bounds of the widget's view. If the height is smaller than the preferred height, it may be preferable to reduce the amount of content you display.