简体   繁体   中英

Swift Subclassing Subclasses of UIViewController

I've created the sample Master-Detail Application in Xcode and I'm trying to setup a child view controller of the MasterViewController (say UltimateViewController ) using:

class UltimateViewController: MasterViewController {}

This compiles, but if I open the storyboard I am unable to change (with autocomplete) the class name for the view controller to UltimateViewController . If I enter the name manually I am unable to wire up any existing @IBOutlets or @IBActions . Any pre-existing outlets show the warning indicator and the application crashes on launch. How can I do this type of inheritance?

StoryBoard sometimes does not re-index project files when you create new ones so they are not available to choose when you want to change the subclass in storyboard. For me I usually Clean the project, Close Xcode, launch XCode, build and the class is now available.

You can also try deleting derived data for the project so it will for a total re-index of the project files. Lastly verify that the target of the file is correct.

Lastly make sure youre using xcode 6 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM