On Sep 1, 2015, at 20:05 , Ken Thomases <[email protected]> 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 protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to