keyEquivalent
解説
ボタンのキーを返します
初期設定は、なしです。
フレームワーク
ApplicationKit
クラス
NSButton
使用可能
10.0
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { [sender setTitle:@"タイトル"]; [sender setKeyEquivalent:@"m"]; NSLog([(NSButton *)sender keyEquivalent]); } @end
//NSButton keyEquivalent @IBAction func function018(sender: AnyObject) { var aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300.0, 200.0), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false, screen: NSScreen.mainScreen()) windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 // var theButton : NSButton = NSButton(frame: NSMakeRect(50.0, 50.0, 100.0, 30.0)) theButton.title = "Change" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction002:") theButton.target = self theButton.setButtonType(.MomentaryLightButton) theButton.keyEquivalent = "l" aWindow.contentView.addSubview(theButton) aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }