Search code examples
macoscocoa-touchiboutletnstoolbarnstoolbaritem

NSToolbarItem is always nil in cocoa touch (os x) Mac?


I have set IBOutlet for NSSearchField but it's always find nil in .m file. Why???

If have any idea then please give answer related to my issues.enter image description here


Solution

  • According to your storyboard, you created NSObject of Appdelegate and through that object you create outlet, that's why its not accessible.

    So, you have to create NSWindowController class and assign this class to WindowController in storyboard. Then declare outlet in that class.

    Now it is accessible and work as you want.