b4433da21b03fe4cb5cbf0b7055d45a8aa4f1b74 — Elias Naur 10 days ago 6ad1544
ui/app: (iOS) use UIView's safeAreaInsets for window insets if available

Unlike UIView's layoutMargins, safeAreaInsets only includes the space
actually taken up by system UI.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
1 files changed, 3 insertions(+), 1 deletions(-)

M ui/app/os_ios.m
M ui/app/os_ios.m => ui/app/os_ios.m +3 -1
@@ 23,11 23,12 @@ // Use 163 as the standard ppi on iOS.
  	CGFloat dpi = 163*scale;
  	CGFloat sdpi = dpi;
+ 	UIEdgeInsets insets = v.layoutMargins;
  	if (@available(iOS 11.0, tvOS 11.0, *)) {
  		UIFontMetrics *metrics = [UIFontMetrics defaultMetrics];
  		sdpi = [metrics scaledValueForValue:sdpi];
+ 		insets = v.safeAreaInsets;
  	}
- 	UIEdgeInsets insets = v.layoutMargins;
  	onDraw(viewRef, dpi, sdpi, v.bounds.size.width*scale, v.bounds.size.height*scale, sync,
  			insets.top*scale, insets.right*scale, insets.bottom*scale, insets.left*scale);
  }


@@ 71,6 72,7 @@ - (void)loadView {
  	CGRect zeroFrame = CGRectMake(0, 0, 0, 0);
  	self.view = [[UIView alloc] initWithFrame:zeroFrame];
+ 	self.view.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0);
  	UIView *drawView = [[GioView alloc] initWithFrame:zeroFrame];
  	[self.view addSubview: drawView];
  #ifndef TARGET_OS_TV