Create instance of class in nib file

岁酱吖の 提交于 2019-12-25 03:49:09

问题


Im going through Apple's OSX Cocoa (Your First Mac Application) tutorial and am up to refactoring the app delegate. I have created my own controller class.

I don't understand how to "Create an instance of the controller class in the nib file". I'm using Xcode 4.


回答1:


Drag an 'Object' from the 'Object Library' in the right pane onto your nib. Next, select the object that you dragged into the nib, and then select the identity inspector (third icon from the left in the top right pane). From these, you can set a custom class. Set the class to be the custom controller that you have created. This will be created for you when the nib is initialized. You can then connect this to an IBOutlet in your AppDelegate (for that custom class).




回答2:


I think what you want is on the inspector, click the third tab, and for the "Custom Class", select your view controller.



来源:https://stackoverflow.com/questions/6886925/create-instance-of-class-in-nib-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!