aspectRatio
ウインドウのアスペクト比
@property NSSize aspectRatiovar aspectRatio: NSSize
解説
ウインドウのアスペクト比
設定値
@property NSSize aspectRatiovar aspectRatio: NSSize
フレームワーク
Appkit
クラス
NSWindow
使用可能
10.0-
参照
関連記事(外部サイト)
例文
//NSWindow aspectRatio func buttonAction058(sender: AnyObject){ var theWindow : NSWindow = (sender as NSButton).window! theWindow.aspectRatio = NSMakeSize(1.78,1.0)//(16:9) } @IBAction func function058(sender: AnyObject) { var aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false) windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 //ボタンを作成 var theButton : NSButton = NSButton(frame: NSMakeRect(100.0, 2.0, 100.0, 30.0)) theButton.title = "set" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction058:") theButton.target = self aWindow.contentView.addSubview(theButton) //ウインドウの表示 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }
更新時のバージョン
OS X 10.10