attributedTitle
属性付タイトル文字列
@property(copy) NSAttributedString *attributedTitle
@NSCopying var attributedTitle: NSAttributedString
解説
属性付タイトル文字列
設定値
@property(copy) NSAttributedString *attributedTitle
@NSCopying var attributedTitle: NSAttributedString
フレームワーク
NSAnimationContext
クラス
NSButton
使用可能
10.0
更新時のバージョン
OS X 10.10
参照
関連記事(外部サイト)
例文
//NSButton attributedTitle @IBAction func function007(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(80.0, 80.0, 150.0, 30.0)) var attributes : Dictionary = [ NSFontAttributeName : NSFont.systemFontOfSize(19.0), NSForegroundColorAttributeName:NSColor.redColor()] var attributedString : NSAttributedString = NSAttributedString(string: "赤いタイトル", attributes: attributes) theButton.attributedTitle = attributedString theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction002:") theButton.target = self theButton.setButtonType(.MomentaryLightButton) //ここまで aWindow.contentView.addSubview(theButton) aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }