• 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 03:46:33 +0000

On Sep 1, 2015, at 20:05 , Ken Thomases <email@hidden> wrote:

As I said, this isn't a show-stopping problem, it's just odd to pull view controlling code *out* of my view controller and put it somewhere else.

Well, if the code needs to change which window is key, which views are present/active within that window, and then which control has focus, then it isn't really view-controlling code.  It's much more global than that.

It’s probably worth being explicit that there are 2 kinds of UI that might apply here.

1. If this is something like a document app, where the view controller implements the document view (and storyboards will tend to encourage putting the view logic here, instead of in the window controller as was more usual in the old days, if for no other reason than analogy to iOS), then the menu item is likely enabled only when the view controller is in the responder chain. In that case, the action method should be in the view controller, even though it’s no longer possible to wire up the target directly in IB.

2. If the menu item really is global, in the sense that it causes a pre-determined window to be brought to the front if necessary, before making a text field first responder, then the action method should be in the app delegate, and this should deal with the activation logic, even if it hands off control to the view controller eventually.

By chance, your response was couched mostly in terms of #2, while mine was mostly #1. It may have seemed like we were making conflicting recommendations about where to put the action method, but there’s really no conflict. There are just different answers, depending on the app design.

 _______________________________________________
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: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Unable to create outlets/connections for NSMenuItems, but other controls work
  • Next by Date: Re: Unable to create outlets/connections for NSMenuItems, but other controls work
  • 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