Classes for the new storyboard view controller

In my storyboard, I drag the new View controller. My storyboard now has two view controllers: the main one that appeared when I created the file, and the one that I dragged.

When I go to the "editor assistant" and select the main view controller, I get the ViewController.h class. But when I select another controller, I get UIViewController.h, which is an Apple file.

How do I link / create these classes for each View Controller? Is there an automated way to do this, or am I not doing it right.

+11
ios objective-c iphone xcode
Jul 07 '12 at 4:14
source share
1 answer

You need to create your own subclass of UIViewController and set the newly created view controller as a custom class in the storyboard.

  • Press cmd + n or select File> New File
  • Select an Objective-C class and click next
  • Enter the UIViewController in the second field and enter the name for the new class in the first field (which will be something like MyClassViewController)
  • Go to your storyboard, select the View Controller that you pulled out, look at the inspector and go to the "Custom Class" tab and set the custom class to the newly created view controller (for example, MyClassViewController).
+26
Jul 07 2018-12-12T00:
source share
— -



All Articles