My Uiviewcontroller Is Not Filling the Entire Screen

My UIViewcontroller is not filling the entire screen?

Set modalPresentationStyle to .fullScreen:

navController.modalPresentationStyle = .fullScreen

UIViewController not filling screen

I think you have an issue with your frame offsets. With the navigation bar enabled the rect you get in appFrame has a y offset of 44.f (the navigation bar's height) - check with NSLog and see if that's true.

Because you are setting the frame of a view that will be placed at the origin it should have x and y origins set to zero. You can do this in a safer manner by checking

CGFloat navHeight = navController.navigationBarHidden ? 0 :
navController.navigationBar.frame.size.height;

In fact I think using the bounds property of [UIScreen mainScreen] may be a better overall solution. It will come with the origin and size set correctly and you shouldn't need to check the presence of the navigation bar.

Check what's going on:

CGRect screenBounds = [[UIScreen mainScreen] bounds]
NSLog(@"%@", NSStringFromCGRect(screenBounds));
CGRect screenFrame = [[UIScreen mainScreen] applicationFrame]
NSLog(@"%@", NSStringFromCGRect(screenFrame));

UIWindow not filling screen for new devices?

Try to add "Launch screen interface file base name" (UILaunchStoryboardName) to your Info.plist

It seems that the presence of this key tells the system that you natively support new device types and size classes, so your window can fill all available area.

Loading UIView from Bundle only fills screen partially

I think you should take a UIview(0,0,0,0 four constraints) in Your Viewcontroller and then assign it a custom class which is a subclass of UIView and then load the Xib file and it will surely occupy the whole screen

Try this man::----

 class QuestionViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let subview = QuestionView()
subview.frame = CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.width)
self.view.addSubview(subview)
}
}

ViewController - Fullscreen

This is an iOS 13 change. Users will start to expect to be able to swipe away modals so it might be worth looking into supporting that.

If you're really set on using the old presentation style you can do so by setting the modalPresentationStyle of the presented viewController either before presenting:

vc.modalPresentationStyle = .fullScreen

or override it in the view controller itself:

override var modalPresentationStyle: UIModalPresentationStyle {
get { .fullScreen }
set { assertionFailure("Shouldnt change that ) }
}

or set in in the storyboard segue:

storyboard segue example

Page views not correctly sized after segue

This has to do with the new default modal presentation style in iOS 13.

To set the prior behavior, you need to change the presentation style to full screen.

You can do this both in storyboard by editing your segue's Presentation attribute and setting it from Automatic to Full Screen:

Sample Image

Alternatively, if you are presenting your View Controller programmatically, you can set your View Controllers modalPresentationStyle before presenting it, like so:

let detailController = /* your View Controller */
detailController.modalPresentationStyle = .overFullScreen
present(detailController, animated: true, completion: nil)


Related Topics



Leave a reply



Submit