简体   繁体   English

IPhone Storyboard - 分配类以在storyboard中查看控制器

[英]IPhone Storyboard - Assigning class to view controller in storyboard

I have created a simple app using storyboard. 我使用故事板创建了一个简单的应用程序。 In storyboard file, i have dragged one view controller. 在storyboard文件中,我拖动了一个视图控制器。 I want to assign a class to the newly added view controller. 我想为新添加的视图控制器分配一个类。 To do this, I clicked on new file in Xcode, clicked on Objective c class , entered class name MyViewController and subclass is of UIViewController. 为此,我在Xcode中单击了新文件,单击了Objective c class ,输入了类名MyViewController ,子类是UIViewController。 I went back to storyboard and clicked on Custom class type and given MyViewController in class tab. 我回到故事板并单击了Custom class类型,并在类选项卡中给出了MyViewController。 But it is not taking this. 但它没有采取这一点。 If i unselect the viewcontroller and select, custom class shows "UIView" again. 如果我取消选择viewcontroller并选择,则自定义类再次显示“UIView”。

I am using Xcode version 4.3.3 (4E3002). 我正在使用Xcode版本4.3.3(4E3002)。

xcode does this problem even if everything is fine. 即使一切都很好,xcode也能解决这个问题。 Close your xcode project and then quit xcode. 关闭你的xcode项目,然后退出xcode。 Start again and you will be able to find the class in the dropdown menu. 再次开始,您将能够在下拉菜单中找到该课程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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