Bisquitue Bisquitue - 11 months ago 43
Objective-C Question

Calling IBOutlet from other class Cocoa

I'm working on a menubar application and now I want to make a feature that when you uncheck a checkbox from the preferences a menu item will hide.

The problem is that the preferences is another class then the AppDelegate and the checkbox is in the Preferences.xib and the menu items are in the MainMenu.xib

Any suggestions?


In Swift lang

if let appDelegate = NSApplication.sharedApplication().delegate as? AppDelegate {
      appDelegate.customMenuItem.hidden = true // or false

where customMenuItem is outlet of your menu item.