How to convert manual view controller to storyboard as a launch screen - xcode

New iOS requirements need Apps for iPhone or iPad must be built with the iOS 13 SDK or later and use an Xcode storyboard to provide the app’s launch screen.
But my project is very old and has never used Storyboards. All UI elements are created dynamically using ViewControllers.
I managed to create a storyboard file and set it as a launcher but it has no scenes and I do not know how to proceed. I would like to:
Create a scene where I place only the original launch image inside (hoping that apple still accepts this branding)
If it is possible to just connect my main ViewController with the scene (if that works with dynamical ViewControllers)
If nothing helps than I would need to create a simple scene which has just a bottom bar like my ViewController

I had this exact issue, here's what I did:
Create LaunchScreen.storyboard and set to use it as launch screen
Using the + button in the top-right (this was not an obvious step), add a View Controller into the storyboard
Untick "Use Safe Area Layout Guides" on the right panel if you're getting that error
Tick "Is Initial View Controller"
Then clean and run, for me it just worked. I did have trouble seeing it update though, as discussed here: Launch Screen storyboard not displaying image

Related

Where did tabbed controller views go in storyboard?

Forgive but I haven't coded in about a year or two, so I haven't been following the latest update in Xcode.
Anyways, I decided to go back and brush up on some skills and I noticed right off the bat that a lot has changed.
I created a new project using the tabbed view controller set up, usually it shows in storyboard immediately upon creating the project. Now there is nothing there. Where did it go and how do I bring it back?
I attached a screenshot so you can see the simulator running the tabbed apps but not showing in storyboard.
enter image description here
You opened the LaunchScreen.storyboard. This layout appears on the screen for a few moments while the app is launching.
https://developer.apple.com/documentation/uikit/app_and_environment/responding_to_the_launch_of_your_app
https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/launch-screen
The storyboard that you are looking for is Main.storyboard
Notice, that there is no Main.storyboard if you start with SwiftUI
There are no specialized app templates any more. But there is still a tab view controller object in the storyboard editor's library, so just drag it into the canvas and use it. It gives you same two-child tab view controller as before.

Second TouchBar

I have two sroryboards in my macOS app (with two separated WindowControllers). I'm wondering how I could in XCode IDE create two TouchBars each connected to own Window Controller Scene in storyboard. Actually I can create two TouchBars but just the one from Main storyboard is shown when I run the app.
What's proper way to customize TouchBar for the second storyboard window?
Thanks.

Toolbar fades out after a second in iOS 11

I'm just starting out on a new app with Xcode 9 and iOS 11. I placed a Toolbar at the bottom of the view, then added suggested constraints. Inside the toolbar I placed two buttons, "Sites" and "Item".
When I run the application, the toolbar disappears after a second whenever I launch the app.
Any idea what's causing this? How do I fix it? There's currently no code added to it, just the elements I've mentioned.
You are putting the elements on the launch screen instead of the actual first screen of the application.
If you are using the default configuration, search for the storyboard called Main.storyboard and put the items you want to show there.

XCode 7: Launch screens may not set custom classnames

I created a simple application using Xcode 7 Beta 2. The application simply contains class MyAppDelegate, MyViewController, MyMain.storyBoard and MyLaunchScreen.storyboard. After recompiling the application with Xcode 7 Beta 4 the error "Launch screens may not set custom classnames" appears. Any suggestions?
Note that the launch screen is not a fully customizable view controller. You cannot specify a custom class name in the storyboard and expect the system to give you the option to execute code at this stage by calling viewDidLoad. Remember, the app hasn’t launched yet.
Launch Screen Constraints
The system loads the launch screen file before launching the app which creates some constraints on what it can contain (some of which may force you back to static image files):
The app is not yet loaded so the view hierarchy does not exist and the system can not call any custom view controller setup code you may have in the app (e.g. viewDidLoad)
You can only use standard UIKit classes so you can use UIView or UIViewController but not a custom subclass. If you try to set a custom class you will get an Illegal Configuration error in Xcode.
The launch screen file can only use basic UIKit views such as UIImageView and UILabel. You cannot use a UIWebView.
If you are using a storyboard you can specify multiple view controllers but there are again some limitations. For example you can embed view controllers in a navigation or tab bar controller but more complex container classes such as UISplitViewController do not work (at least not yet).
Localizing the launch screen file does not currently seem to have any effect. The base localization is always used so you will probably want to avoid text on the launch screen.
You cannot specify different launch screen files for iPad and iPhone. This may be a problem if you have significantly different interfaces for those devices as there is only so much you can do with auto layout and size classes.
If you are deploying to iOS 7 you will still need to include the static launch image files. You can include both a launch screen file and static launch images. Devices such as the iPhone 6 running iOS 8 will use the launch screen file whilst iOS 7 devices will fallback to the launch images.
For more details please click here
This is a simple answer, but something I did and didn't even know it. I think with iOS 7, there is now a main.storyboard and a launchscreen.storyboard. I was unwittingly trying to build my initial functional screen on the launch screen.storyboard. That's a no no.
Hope this helps and happy coding!
Go through your View Controllers in Main.storyboard and make sure you don't have one that is both set to a custom class:
and has "Is Initial View Controller" checked:
You can only do one or the other. Somehow I had "Is Initial View Controller" still checked by mistake, and it took me a while to hunt that down!
I recently created an app using the Xcode 8 beta but couldn't submit it to the app store using the beta software. I had the same error message: "Launch screens may not set custom classnames" and several other.
My solution: Go to the File Inspector of the Main Storyboard and deselect the Use as Launch Screen option. Simple, right? Hopefully this works for you too.
Here's an image of what to look for

Showing views in interface builder outside viewcontroller hierarchy in xcode5

I often make use of views in interface builder that live outside of the viewcontroller hierarchy (see screen grab below for simple example).
Before upgrading to Xcode5 I could get this view to appear on the storyboard by writing an IBAction outlet and dragging a connection from the code to the view in the storyboard.
If you paused over the button for a moment it would flash and then open up as a view on the storyboard that is then a lot easier to work with.
Since upgrading this function no longer seems available. Has anyone found out how to get these views to appear on the storyboard?
Edit:
Using the temporary viewcontroller as described in this answer seems one approach, although fiddly since you need to move the UIView stack between viewcontrollers each time you want to edit the layout. Using a separate XIB is starting to seem like the sanest approach.
https://stackoverflow.com/a/13713385/1060154
Finally, we get this back in Xcode 7.
Hallelu!

Resources