allowsMixedState
解説
ボタンの状態がMixedかどうか返します。
YESならMixed,on,offの3つの状態(Mixed)
NOならon,offの2つの状態
デフォルトはNoです。
Mixedの状態
フレームワーク
ApplicationKit
クラス
NSButton
使用可能
10.0
例文
//NSButton @IBAction func function014(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(100.0, 90.0, 100.0, 30.0)) theButton.title = "Change" theButton.bezelStyle = NSBezelStyle.RegularSquareBezelStyle theButton.setButtonType(NSButtonType.SwitchButton) theButton.action = Selector("buttonAction002:") theButton.target = self theButton.allowsMixedState = true aWindow.contentView.addSubview(theButton) aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //senderはボタン if ([sender allowsMixedState]){ [sender setTitle:@"YES"]; }else{ [sender setTitle:@"NO"];} } @end