Storyboard uiviewcontroller, 'custom class' not showing in drop down

后端 未结 25 1077
北荒
北荒 2020-12-08 01:34

I have a UIViewController I created in my apps storyboard, as well as a custom UIViewController subclass which I added to the project (and is correctly in the compile phase

相关标签:
25条回答
  • 2020-12-08 02:31

    I had been having the same issues as described in this problem. However, none of the suggested answers fixed it for me. My project compiled OK without warnings or errors, but, in the .h file there were no 'outlet' indicators to indicate that my outlets had been linked to storyboard elements.

    Additionally, attempts to create new outlets in my code, by right-click and dragging into my header file, were not recognising my header source as a potential target for this operation. And furthermore, my Class did not make an appearance in the Custom-Class dropdown for the ViewController's property inspector panel.

    And yet, the project compiled OK.

    Closer examination showed that I had defined my own class in the following manner...

    @interface KJBMainDataViewTrackConMk2<UIScrollViewDelegate> : UIViewController
    

    which apparently compiles nicely.

    But, if this is changed to the following, (moving the protocols to the end)...

    @interface KJBMainDataViewTrackConMk2 : UIViewController<UIScrollViewDelegate>
    

    Then everything springs to life. All outlets are suddenly indicated as being 'connected' with a storyboard element. And right-click dragging starts to work again, and my custom class appears in the custom-class drop-down in the property inspector panel for the storyboard ViewController!

    Other answers here probably represent the most likely causes of this condition, but, I felt it worth mentioning at least this one other potential cause.

    0 讨论(0)
提交回复
热议问题