macOS/iOS API解説

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

目次

name

INDEX>AppKit>NSAppearance

アピアランス

Objective-C

@property(readonly, copy) NSString *name

Swift

var name: String { get }

解説

アピアランスの名前(読み込みのみ)

設定値

Objective-C

@property(readonly, copy) NSString *name

Swift

var name: String { get }

フレームワーク

ApplicationKit

クラス

NSAppearance

使用可能

10.9-

更新時のバージョン

OS X 10.11

参照

関連記事

例文

    //NSAppearance initWithAppearanceNamed:bundle:
    //http://cocoaapi.hatenablog.com/entry/Appkit/NSAppearance/initWithAppearanceNamed_bundle_
    //NSAppearance name
    //
    @IBAction func function001( sender: AnyObject) {
        //アピアランスの変更
        let ap : NSAppearance = NSAppearance(named: NSAppearanceNameVibrantDark)!
        NSLog("name = %@",ap.name)
        //->name = NSAppearanceNameVibrantDark
        let 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.appearance = ap
        aWindow.center()//ウインドウをスクリーンの中心に
        aWindow.title = "ウインドウタイトル"//タイトル設定
        //
        let theButton : NSButton = NSButton(frame: NSMakeRect(50.0, 50.0, 100.0, 30.0))
        theButton.title = "Change"
        theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle
        theButton.action = Selector("buttonAction001:")
        theButton.target = self
        theButton.setButtonType(.MomentaryLightButton)
        //.SwitchButton
        //.PushOnPushOffButton
        aWindow.contentView!.addSubview(theButton)
        
        aWindow.orderFront(self)//前面に
        aWindow.makeKeyAndOrderFront(self)//表示
        
        
    }