macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

NSBezelStyle

INDEX>AppKit>NSButton

ボタンの形状

Objective-C

Swift

enum NSBezelStyle : UInt {
    case RoundedBezelStyle
    case RegularSquareBezelStyle
    case ThickSquareBezelStyle
    case ThickerSquareBezelStyle
    case DisclosureBezelStyle
    case ShadowlessSquareBezelStyle
    case CircularBezelStyle
    case TexturedSquareBezelStyle
    case HelpButtonBezelStyle
    case SmallSquareBezelStyle
    case TexturedRoundedBezelStyle
    case RoundRectBezelStyle
    case RecessedBezelStyle
    case RoundedDisclosureBezelStyle
    case InlineBezelStyle
}

解説

【ボタンの形状】
Bevel
f:id:jjj777:20150227204114g:plain

Push
f:id:jjj777:20150227212848g:plain

Check
f:id:jjj777:20150227213346g:plain

Radio
f:id:jjj777:20150227214038g:plain

Round
f:id:jjj777:20150227214647g:plain

Square
f:id:jjj777:20150227214928g:plain

Disclosure Triangle
f:id:jjj777:20150227215247g:plain

Textured
f:id:jjj777:20150227221852g:plain

Help
f:id:jjj777:20150227220347g:plain

Gradient
f:id:jjj777:20150227222142g:plain

Round Texture
f:id:jjj777:20150227222553g:plain

Disclusure
f:id:jjj777:20150228110942g:plain

RoundRect
f:id:jjj777:20150228110059g:plain

Receseed
f:id:jjj777:20150228112227g:plain

Inline
f:id:jjj777:20150228112339g:plain

フレームワーク

ApplicationKit

クラス

NSButton

使用可能

10.0

更新時のバージョン

OS X 10.10

参照


bezelStyle - Cocoa API解説(iOS/OS X)

関連記事(外部サイト)

例文

Objective-C

Swift

    //NSButton setPeriodicDelay
    var counter004 : Int = 0
    func buttonAction004(sender: AnyObject?){
        var theWindow : NSWindow = (sender as NSButton).window!
        (sender as NSButton).title = String(counter004++)
    }
    @IBAction func function004(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("buttonAction004:")//ボタンを押した時に動かす関数
        theButton.target = self//ターゲット
        theButton.continuous = true //メッセージを繰り返し送信する
        
        var floatValue1 : Float = 0 //delayを入れる
        var floatValue2 : Float = 0 //intervalを入れる
        
        theButton.getPeriodicDelay(&floatValue1,
            interval: &floatValue2)
        //-> : 0.400000,2 : 0.075000
        
        theButton.setPeriodicDelay(0.5,interval :0.3)
        
        aWindow.contentView.addSubview(theButton)
        
        aWindow.orderFront(self)//前面に
        aWindow.makeKeyAndOrderFront(self)//表示
        
    }