On Sep 1, 2015, at 20:51 , Alex Hall <[email protected]> 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 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