Reputation: 55002
I'm trying to make a Cocoa app with buttons that run simple command line scripts.
I can't seem to figure out how to add the action to my button.
I've read some docs that suggest holding down option and dragging the button into controller code but I think they are out of date.
Can someone suggest how to get there from this screenshot?
Upvotes: 1
Views: 8504
Reputation: 177
Actually I had the same problem and the root cause was just the drag method. From the descriptions I had assumed that I need to press CTL and then drag while having the left mouse button pressed. This did not work at all (in my environment). Then I noticed that "it works" with the right mouse button. But the result was not correct. (E.g. I could not get "Action"). Finally I found: I have to use the right mouse button only for dragging without holding CTL. Then I got the correct result.
Upvotes: 0
Reputation: 1232
You need to first select your button, then hold the control ⌃
button on your keyboard and then drag that across to your view controller. That will then give you the option of what to name your method etc.
Upvotes: 8