0
votes

I have a problem with my code. My application displays within iOS safe area layout guide, however I'd like to force it to display "outside". I have searched the internet and unfortunately I found only "reverse" problems. I don't use interface builder, all my views I create programmatically. I have a main view controller which starts up automatically with the app and from here I start creating all my stuff. My interface builder just shows this view controller and a view assigned to it. Interestingly, the view appears to be really full screen when viewed in IB.

Yes, I tried turning on/off the "Use Safe Area Layout Guide" option for the view. Also I tried to use topLayoutGuide and bottomLayout guide instead and constrain the main view to them, but it still fails:

- (void)viewDidLoad {
     [super viewDidLoad];
     UILayoutGuide *margins = self.view.safeAreaLayoutGuide;
     [NSLayoutConstraint activateConstraints:@[[self.view.topAnchor constraintEqualToAnchor:self.topLayoutGuide.topAnchor],
                                          [self.view.bottomAnchor constraintEqualToAnchor:self.bottomLayoutGuide.bottomAnchor]
                                          ]];

     //...
}

This is what I see in the IB:

1) view

enter image description here

2) safe area - I can't get rid of it in any way:

enter image description here

3) result (simulator / real device):

enter image description here

I also did RTFM but a) I'm stupid, b) I'm too tired, c) both

Any help would be appreciated :)

2
Do you use constraints ? - Julius
Basically I use auto layout everywhere, but I don't have any code that sets any constraints to this view, so I believe this is getting arranged by iOS itself somehow. - user1880342
Ok, I think I found the issue. I created a new project and everything works there well. I started examining the differences in project settings, etc. and found out that the new one does not use Launchimage, but my app uses. So I tried deleting the launchimage from my app and it started working. From there I started checking what's going on and finally I found that my app is missing Launchimage assets for iPhone X. I added one with designated size and now it works fine, no additional changes required. It seems that iOS automatically fallsback to smaller screen if there is no proper launchimage. - user1880342

2 Answers

0
votes

If you use constraints on the view, it will usually automatically align to the safe area. You can override this and have it constrain to the superview instead by clicking the little arrow to the right for a drop down menu:

enter image description here

You then select "View" instead of "Safe Area". Also make sure to un-click "Constrain to margins" or it still won't fill out the whole screen.

0
votes

I resolved my issue. The application was not displaying in full screen because of missing launch image in my assets for iPhone XR. Because of this iOS was falling back to the closest launch image keeping aspect ratio, thus defining the application size.

The second issue (not loading the image, displaying some default splash screen insead) - removing the app from device and installing from scratch helped.

Thanks everyone involved :)