iOS Thickness should be multiple to 2
See original GitHub issueDescription
I discovered that, for example, to change the SafeArea in iOS, the values must be multiplied by 2. This is probably because of the retina.
But in large iPads there is a factor of 3x.
Maybe we should add some property that will depend on the system and we can multiply by it without worrying about compatibility?
https://developer.apple.com/documentation/uikit/uiscreen/1617836-scale
swift:
UIScreen.main.scale
cs:
UIKit.UIScreen.MainScreen.Scale
Steps to Reproduce
var scene = UIKit.UIApplication.SharedApplication.ConnectedScenes.ToArray<UIKit.UIWindowScene>().FirstOrDefault();
if (scene != null)
{
var windowScene = (UIKit.UIWindowScene)scene;
var safeArea = windowScene.Windows.FirstOrDefault()?.SafeAreaInsets;
Padding = new Thickness(
-(safeArea.Value.Left * 2), //left
Padding.Top, //safeArea.Value.Top, //-(safeArea.Value.Top * 2),// top,
-(safeArea.Value.Right * 2), //right
-(safeArea.Value.Bottom * 2)); //bottom
}
Link to public reproduction project repository
no
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Should the dimensions (height/width) of the retina images ...
Currently that scale factor is 2 for iPhone 4 and iPhone 4s. This means that the backing stores on retina displays will always...
Read more >Layout | Apple Developer Documentation
As a general rule, display no more than three buttons that contain glyphs — or two buttons that contain text — in a...
Read more >How to make two views the same width or height
On iOS, the key is to give each view you want to size an infinite maximum height or width, which will automatically make...
Read more >iPhone 12 mini - Technical Specifications
Size and Weight2. Width: 2.53 inches (64.2 mm); Height: 5.18 inches (131.5 mm); Depth: 0.29 inch (7.4 mm); Weight: 4.76 ounces (135 grams) ......
Read more >iOS 16 - Master the NEW Lock Screen & Home Screen!
These features include widgets from first-party and third-party apps, depth effect on the Lock Screen, live activities, customizing the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes, if you are using a higher density display, the density will be higher: https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.devices.displayinfo.density?view=net-maui-7.0#remarks
But you really only need to know this if you are doing platform-specific work. For anything cross-platform, the density scaling is accounted for automatically. If you set the Padding for a Grid to 10, that value will be multiplied by the screen density for you by the layout engine; you don’t need to worry about it.
If you’re doing some sort of layout work in platform-specific code (e.g., in UISceneDelegate), and you need to account for the density yourself, then use DisplayInfo.Density.
You multiplied by 2 and got the right size, I just think it would be nice to have some kind of constant for this.
because in case Apple releases new size screens, I’m afraid to imagine how many of these “multiply by 2” are in the production code. even in the maui code base there is such a thing.