4

In a OS X app, if I have a form with a couple of buttons, how do I nominate a default button for the form? By default button I mean the button that acts when I hit Enter.

I've been trying to learn Swift, and so I've been experimenting building little OS X apps using Xcode 6.

All my programming experience is in Windows desktop applications, so I might be looking at this all wrong, and maybe using the wrong terminology here.

3
  • 1
    Did you find developer.apple.com/library/mac/Documentation/Cocoa/Conceptual/… and try a literal Swift translation of that?
    – Tommy
    Commented Aug 29, 2014 at 21:53
  • @Tommy I tried searching in Apple's documentation but couldn't find the answer. That's why I thought I was not using the correct terminology. Not even searching by the title of your link gives me your link as one of the answers. I need to learn how to use that documentation.
    – alondono
    Commented Aug 29, 2014 at 22:29
  • I wouldn't bother; Apple's existing documentation HTML has serious issues — e.g. pinch to zoom isn't usable even on Apple devices — so the whole lot is getting an overhaul with the iOS 8 launch. Don't waste time getting used to it now!
    – Tommy
    Commented Aug 29, 2014 at 22:44

1 Answer 1

12

Set they button's key equivalent to \r. This is most easily done in Interface Builder by selecting "Key Equivalent" and pressing Enter.

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.