Search code examples
iosxcodefunctionuiviewcontrollerviewcontroller

How see code-view for view controller in Xcode?


In my Xcode project, I have several view controllers in my storyboard. How can I see the code for a specific view controller?

Because each view controller will need to have different functions from the others. So, where can I write that code?

Thanks!


Solution

  • By default, storyboard will use UIViewController for the view controllers you use.

    However you can change the class used for the view controller by:

    1. selecting the view controller (in Interface Builder)
    2. show the identity inspector (View > Utilities > Show identity inspector)
    3. Change the value in Class to "MyOwnViewController"

    Where "MyOwnViewController" is the name of the UIViewController subclass that you want to use for that view controller.