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:
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:
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
How to Use a Variadic Closure in Swift
How to Cast an Any Value with Nil in It to a Any
Incorrect String to Date Conversion Swift 3.0
How to Bring Nswindow to Front and to the Current Space
Singleton and Init with Parameter
How to Compare Just the Time of a Date in Swift
How to Detect and Make Clickable Links in a Uilabel Not Using Uitextview
Arkit -Drop a Shadow of 3D Object on the Plane Surface
Swift Performseguewithidentifier Shows Black Screen
Binding in a Foreach in Swiftui
What's the Best Way to Iterate Over Results from an API, and Know When It's Finished
Pdfview Does Not Display My PDF
How to Click a Button Programmatically
How to Go from Cmutablepointer<Cgfloat> to Cgfloat[] in Swift
How to Tell Which Guard Statement Failed
Swift - Reorder Uitableview Cells
Most Efficient Way to Access Multi-Dimensional Arrays in Swift