thecodingmate
thecodingmate

Reputation: 331

How do I associate a Storyboard UIViewController with my custom UIViewController class?

I'm running Xcode 7 beta 5 and I have a storyboard with a tab bar controller featuring 4 items. Each item is a UIViewController. I created a custom class that is a subclass of UIViewController.

When I go to the storyboard, click on one of the UIViewControllers, go to the Identity Inspector, click on custom class, and try to name my custom class it says,

"Launch screens may not set custom classnames"

Am I doing something wrong? I thought this was the way to associate a storyboard's UIViewController with your custom view controller.

Upvotes: 2

Views: 7458

Answers (5)

UsamaMan
UsamaMan

Reputation: 705

This worked for me. I deleted LaunchScreen.storyboard and in main.storyboard I added the custom class which did not give any error later. Hope it helps someone else too.

Upvotes: 0

Rohit Kumar
Rohit Kumar

Reputation: 887

If you are trying to customize your Splash Screen then you can create your first view controller as Splash Screen and then set a custom class there.

To tell the system that not to load launch screen just change the settings as mentioned below...

General Tab --> Launch Screen File --> Select "Main" (Basically it's Main Storyboard).

Upvotes: 1

Rukshan
Rukshan

Reputation: 8066

You can set a custom class to any storyboard component except the launchscreen.xib file.

Upvotes: 0

Daumantas Versockas
Daumantas Versockas

Reputation: 777

The problem is that you are trying to assign a custom class to launch screen. Launch screens main function is to display a view until application loads (not to implement application logic). You should create a new view controller representing object in storyboard (this one should be displayed after application load) and assign a custom class to it.

Upvotes: 6

JonEasy
JonEasy

Reputation: 1013

As the error message says, custom classes are now forbidden in Launch Screens in Xcode 7. See e.g. here as well

Upvotes: 1

Related Questions