• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unable to create outlets/connections for NSMenuItems, but other controls work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unable to create outlets/connections for NSMenuItems, but other controls work


  • Subject: Re: Unable to create outlets/connections for NSMenuItems, but other controls work
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 02 Sep 2015 04:26:41 +0000

On Sep 1, 2015, at 20:51 , Alex Hall <email@hidden> wrote:

My problem now--and this also lets us get back to Xcode usage--is connecting these to the First Responder.

The process you described earlier, using VO to “drag” from the button in the margin of the source code action method to the menu item, sounded correct, but didn’t work work because you were inadvertently crossing a scene boundary. It *should* work if the action method is in the right place.

I was also able to go in the other direction, dragging from the “action” button in the Sent Actions section of the Connections inspector when the menu item was selected, to the source code of the action method (the actual code this time, not the button next to it).

Neither of these things involve the Control key, but they require displaying two different panes in the Xcode window.

However, as I said before, it’s all a bit murky. Sometimes IB refuses to make a connection that seems like it should be acceptable, and I can never work out why. Hitting the screen with a heavy blunt object might make you feel better.

Handing off control would be good, that way I could use appDelegate as a kind of entry point but keep most of my logic (and outlets) in the view controllers where they belong. Hopefully I can work out how to do just that; I imagine the appDelegate has a way of accessing the view controller, it's just a matter of finding out how.

If you put the action method in the app delegate — the intuitive answer in your case — there’s no good “how”. The view controller pretty much has to call a method of the app delegate to tell the app delegate who it is. (You can’t have a NIB outlet from the app delegate to the view controller for the same scene boundary reasons we already talked about.)

Or, if your window organization is fixed, the app delegate can find the current main window, then find its window controller, then find its content view controller, which you may or may not find hack-ish.

Or, you can have the app delegate keep track of window controller(s), delegate the action to the window controller, which in turn delegates to a suitable view controller. This is probably the most elegant approach, but there’s a fair amount of housekeeping to set this up.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Unable to create outlets/connections for NSMenuItems, but other controls work
      • From: Alex Hall <email@hidden>
References: 
 >Unable to create outlets/connections for NSMenuItems, but other controls work (From: Alex Hall <email@hidden>)
 >Re: Unable to create outlets/connections for NSMenuItems, but other controls work (From: Quincey Morris <email@hidden>)
 >Re: Unable to create outlets/connections for NSMenuItems, but other controls work (From: Alex Hall <email@hidden>)
 >Re: Unable to create outlets/connections for NSMenuItems, but other controls work (From: Quincey Morris <email@hidden>)
 >Re: Unable to create outlets/connections for NSMenuItems, but other controls work (From: Alex Hall <email@hidden>)

  • Prev by Date: Re: Unable to create outlets/connections for NSMenuItems, but other controls work
  • Next by Date: Connections on NSWindowController sub-classes
  • Previous by thread: Re: Unable to create outlets/connections for NSMenuItems, but other controls work
  • Next by thread: Re: Unable to create outlets/connections for NSMenuItems, but other controls work
  • Index(es):
    • Date
    • Thread