Landscape only iPad application using Mono Touch - c#

I'm using Mono Touch to develop a landscape-only iPad application but the simulator doesn't seem to rotate any of the views (or the main window for that matter) to landscape.
I've set the SDK version and Minimum OS version to 4.2.
I have also set the Supported Orientations to Landscape.
Furthermore, I've created a Navigation Controller which overrides the ShouldAutorotateToInterfaceOrientation and sets it to return true. I then added it using window.AddSubview(navigationController.View) but that didn't help either.
I'm using the Rotate Left/Right methods (under Hardware) in the simulator but the whole app rotates with the window and the app stays in Portrait mode. Even the status bar (carrier, time, battery) go off to the right instead of moving up to the top of the screen.
Help?! Anyone?!

Have you set the UIInterfaceOrientation key to landscape as well?
Also, in shouldAutorotateToInterfaceOrientation you'll want to only return true if the new orientation matches the orientation you want.

Related

Ipad resolution for landscape and portrait - Xamarin ios

I am relatively new to Xamarin ios and am creating an application that
will work in both Landscape and Portrait for both iPhone and iPad.
I have been able to implement both Landscape and portrait on iPhone pretty fine by using a rotation callback method that will invoke a different view with the same layout but adjusted dimensions for the landscape version and on the landscape version I have the same to go back to portrait. This works okay but has some lag at times.
I'm not very sure about what is the right way to present two different UIs for different orientations. If anyone has any suggestions please let me know.
Now I have a list that holds values for Height and Width of the current device and I will devise this by the current device density like so:
maindisplayinfo.height / maindisplayinfo.density
and this gives me the current display dimensions I need. I use this to place my objects relative to a screen portion such as:
CGRect(0, Height * 0.30, Image.Bounds.Width, Image.Bounds.Height)
On rotation on Ipad, the display goes funny even though I have set dimensions correctly and my rotation callback triggers the different views. Not sure what is going on here.
But is there a certain way to do this sort of thing with iPad and iPhone?

WPF Issues Creating Window on Secondary Screen Only On Certain Hardware Configurations

I'm using the standard recommendation for creating a Window and having it display on a secondary monitor:
I use the following to get the screens available:
Screen[] availableScreens = Screen.AllScreens;
Extract the working area of the target screen (second screen in my case, not the primary screen):
secondaryScreenWorkingArea = availableScreens[1].WorkingArea;
When creating the window, set the location properties based on the working area (before calling Show()):
Left = secondaryScreenWorkingArea.Left;
Top = secondaryScreenWorkingArea.Top;
Width = secondaryScreenWorkingArea.Width;
Height = secondaryScreenWorkingArea.Height;
Some other things to note about the window:
It is a fullscreen window that is intended to span the entire second
display
It is not the main application window
It is hidden from the taskbar, it is intended to be supplemental to
the main application window
WindowState = WindowState.Maximized;
ShowInTaskbar="False"
WindowStyle = WindowStyle.None;
Running on Windows 10 Enterprise V 1809
Below is a rundown is different configurations that I've tested, and only one of them is not behaving correctly:
When I run this on a workstation setup with two 1920x1080 displays, 100% display scaling, it works as expected.
When I run this on a workstation setup with two 1920x1080 displays, 150% display scaling, it works as expected.
When I run this on a workstation setup with a 1920x1080 display and a secondary USB display (800x480) connected, 100% display scaling, it works
When I run this on a workstation setup with a 1920x1080 display and a secondary USB display (800x480) connected, 150% display scaling, it works
When I run this on a Microsoft Surface Go with the main surface display (1800x1200) and a secondary USB display (800x480) connected to the surface dock, 100% display scaling, it works
When I run this on a Microsoft Surface Go with the main surface display (1800x1200) and a secondary USB display (800x480) connected to the surface dock, 150% display scaling, it DOES NOT work. Instead, once Window.Show() is called, this is triggering the window to relocate to the primary display (The surface go screen). I noticed this because I am receiving a LocationChanged event for the window during my call to Window.Show() and see the Width and Height properties have updated to the sizing of the Surface Go display (1800x1200). But, curiously, the Top and Left properties are NOT updated even though the window has moved.
As you can see from the cases above, it seems to be an issue with Display scaling + the Surface Go. On my workstation, I forced the same resolution as the Surface go (1800x1200) and set display scaling to 150%, but could not replicate the issue from the Surface Go
Furthermore, I performed some testing with another USB display with a slightly higher resolution (1024x600) and have noticed that the same issue occurs, only on the Surface Go, but this time it required me pushing the display scaling to 200% before the issue began to occur in that configuration.
Several things I've tried, but none produced any solutions to this issue:
Tried various configurations of dpiAware and dpiAwareness. These changed the scaling of the coordinates I received when grabbing the AvailableScreens, but using scaled/unscaled coordinates had not affect on this issue
Restarting the Surface Go after changing the display scaling option (per the "Some apps won't respond to scaling changes until you sign of" message displayed in the Display Settings
Tried setting WindowState = WindowState.Maximized both before and after the Loaded event and both yielded the same result.
Any help or other ideas for things to try would be appreciated, not sure if this is a WPF, Windows 10 or a Microsoft Surface Go issue.

Xamarin Forms - iOS - change splash screen depending on screen orientation

I have a problem with adjusting splashscreen in Xamarin Forms iOS project.
I'd like to change splashscreen static image depending on screen orientation.
In Android I simply, created drawable-land folder, put there image for landscape orientation and it's working.
In iOS project there is whole designer for purpose of creating launchscreens, but I can't find anything that will do the job. When I adjust image for Iphone, change orientation in designer I can't simply put there different image because it's shared across all screens in designer.
One important remark - I found some sources on how to achive that, but for native XCode designer, I need an answer for Visual Studio or VS for Mac.
Thanks in advance
Here whatever you apply, will be applied to landscape and portrait universally.
You can have different images, one for portrait 'splash_portrait.png' and one for landscape 'splash_landscape.png' in Assets.
You can then choose which image to display for landscape and which for portrait using Edit Traits button on the bottom right corner in your screenshot.
Landscape uses Any or Compact Height size class, so you would be selecting Compact Height checkbox and whichever change you apply, will be applied for this size class (landscape).
Please get more details on this, here & here
Practically, I haven't tried as while giving answer, I am away from computer. But I hope this will help.
https://www.youtube.com/watch?time_continue=1&v=y3lspdPxc6o,
Refer this tutorial video by Kym Phillpotts - Xamarin University Lightning Lecture.
On the widget properties, you have an option for the full-size splash.

Fix orientation of uwp app - windows 10

Irrespective of the orientation of device my app should run in portrait mode only.
Every page except only one page should run on the landscape.
How can I achieve this?
I tried below things:
On manifest file, I have checked supported rotation to "portrait" only.
And written below code on the page I need to show in a landscape,
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape | DisplayOrientations.LandscapeFlipped;
}
But when run with simulator, it works in both portrait and landscape mode. What is the reason for it?
I have to rotate the simulator to 90 degree for seeing the app in portrait mode.
If you check the DisplayOrientations Enum document, you could see the remark shows:
Applications typically use this property to translate the reading of an accelerometer or to translate the physical button events in accordance with the current screen rotation.
It means that it has no effect on simulator. Besides, Auto-rotation also will be turned on by the user.
Please see the similar thread for more details:How to enable only landscape mode in a UWP app?

WPF orientation on Windows Surface

We have a C# WPF application that works great across every Windows tablet we have tested with except for the Microsoft Surface. Our app is specifically set to only run in portrait mode, for example, and yet when you run the app on a Surface the orientation rotates based on the orientation of the device.
No other device behaves this way. Its as if the Surface overrides any orientation settings that are set in the app and decides for itself what orientation to use.
Is there a way to prevent this?

Categories