Bug 21245 - Wrong dimension from UIScreen.MainScreen.Bounds when no launch images are defined
Summary: Wrong dimension from UIScreen.MainScreen.Bounds when no launch images are def...
Status: RESOLVED FEATURE
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.2.5
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-10 16:00 UTC by Doug G
Modified: 2014-07-15 17:55 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Bounds with launch image (34.57 KB, image/jpeg)
2014-07-15 14:52 UTC, Doug G
Details
Bounds without launch image (29.08 KB, image/jpeg)
2014-07-15 14:52 UTC, Doug G
Details
iOS simulator screen shot with launch image (61.13 KB, image/png)
2014-07-15 14:53 UTC, Doug G
Details
iOS simulator screen shot without launch image (50.57 KB, image/png)
2014-07-15 14:53 UTC, Doug G
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description Doug G 2014-07-10 16:00:47 UTC
If an iOS project doesn't have any launch images defined, UIScreen.MainScreen.Bounds will always return a height and width of 480 and 320, respectively. I was able to reproduce this by removing the launch images from the FormGallery example project.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-07-15 12:46:35 UTC
Where did you find the FormGallery example project?

I tried creating a new project from a template, and UIScreen.MainScreen.Bounds worked fine without any launch images.
Comment 2 Doug G 2014-07-15 14:52:18 UTC
Created attachment 7368 [details]
Bounds with launch image
Comment 3 Doug G 2014-07-15 14:52:41 UTC
Created attachment 7369 [details]
Bounds without launch image
Comment 4 Doug G 2014-07-15 14:53:22 UTC
Created attachment 7370 [details]
iOS simulator screen shot with launch image
Comment 5 Doug G 2014-07-15 14:53:44 UTC
Created attachment 7371 [details]
iOS simulator screen shot without launch image
Comment 6 Doug G 2014-07-15 14:58:56 UTC
I got the example from the GitHub site (https://github.com/xamarin/xamarin-forms-samples).

And I apologize, left of the key detail that this is an issue when running an iOS app in the Retina 4-inch simulator or deploying it to a similar device.

Attached are screen shots of the simulator and bound reported in Visual Studio's debugger with and without the launch screen defined when run against the Retina 4-inch simulator. In the simulator screen shot without the launch image defined, there are back bands at the top and the bottom. The debugger says the bounds are that of the 3-inch iOS simulator. When the launch image is defined, the app fills the full screen of the simulator and the height on the bounds is correctly being reported.
Comment 7 Rolf Bjarne Kvinge [MSFT] 2014-07-15 17:55:53 UTC
The presence or not of the launch image is how Apple decided to determine if you're compatible with 4 inch devices or not.

Here's a bit more information: http://redth.codes/get-your-monotouch-apps-ready-for-iphone-5-today/

In short: if you don't have the launch image, iOS will think your app doesn't know about the 4 inch size, and will tell your app the screen is 3.5 inches.