Xcode 6 & Swift: Black Bars Appear Above and Below the Viewcontroller on iOS 7 iPhone 5 Device

New Xcode 6 project looks not full screen on iPhone 5

As described in comments, the solution is to add a LaunchScreen.xib and setting it as Launch Screen File in project's settings.

iOS 9 Xcode 7 - Application appears with black bars on top and bottom

Did you migrate your app from an earlier version of Xcode? If so then Xcode is now making an assumption about your screen size and you need a way of indicating the actual screen size at run time.

There are two ways:

a) If you use a launch screen.

You are missing a LaunchScreen.storyboard file.
Create a Launch Screen object from the New File... dialog

launch screen creation

b) If you don't use a launch screen.

Go to your Target's settings and choose General, then App Icons and Launch Images.
Now set "Launch Screen File" to your "main.storyboard" (or another storyboard if appropriate)

iOS - Swift - Screen Resizes on App Start

Xcode 6 & Swift: Black bars appear above and below the viewcontroller on iOS 7 iPhone 5 device

Someone has a very similar problem, it seems they solved it by changing the size of their launchscreen.xib. Without seeing code its difficult to say what your problem is though

New app to run on iPhone 5 like the old apps do (centered in screen with 2 void areas above and below)

As was already mentioned as the solution in the comments by rmaddy and I:

just deleting default-568h@2x.png and removing the app from the device and doing a clean build is all that was needed to "fix" the problem.

App launches in full screen in simulator, but not on device

Managed to fix the problem. In the General settings for the target, under "App Icons and Launch Images" I clicked the "Use Asset Catalog" button and followed the options.

App Icons and Launch Images screenshot

Black bar appears under navigation bar

Late answer but I stumbled across this problem today and found your question and it doesn't have an accepted answer yet.

I got this error while going from a prompted viewController to a non prompted viewController in storyboard.

I got that black bar just like you.

And to fix:

// In prompted vc
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
UIView.setAnimationsEnabled(false)
self.navigationItem.prompt = nil
UIView.setAnimationsEnabled(true)
}

This will remove the prompt instantly before switching viewcontroller.

UPDATE

func prompt() -> String? {
return nil
}

override func viewWillAppear(animated: Bool) {
let action = { self.navigationItem.prompt = self.prompt() }

if self.navigationController?.viewControllers.count <= 1 {
UIView.performWithoutAnimation(action)
}
else {
action()
}
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
UIView.performWithoutAnimation {
self.navigationItem.prompt = (segue.destinationViewController as? ViewController)?.prompt()
}
}


Related Topics



Leave a reply



Submit