preservesContentDuringLiveResize
@property BOOL preservesContentDuringLiveResize
var preservesContentDuringLiveResize: Bool
解説
調査中...
ライブリサイズの効率のために使うようだが、使いドコロがわからない
返り値
( BOOL )
YES/NO
引数
フレームワーク
ApplicationKit
クラス
NSWindow
使用可能
10.4
参照
-setPreservesContentDuringLiveResize:
-preservesContentDuringLiveResize (NSView)
更新時のバージョン
OS X 10.10
例文
//NSWindow テーブルのあるビュー //NSWindow preservesContentDuringLiveResize func buttonAction066(sender: AnyObject){ var aWindow : NSWindow = (sender as NSButton).window! if (aWindow.preservesContentDuringLiveResize) { aWindow.preservesContentDuringLiveResize = false (sender as NSButton).title = "NO" }else{ aWindow.preservesContentDuringLiveResize = true (sender as NSButton).title = "YES" } } @IBAction func function066(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("buttonAction066:") theButton.target = self aWindow.contentView.addSubview(theButton) //ボタンの制約設定 //falseを設定する theButton.translatesAutoresizingMaskIntoConstraints = false //先にaddSubviewする aWindow.contentView.addSubview(theButton) var viewDictionary:Dictionary = ["theButton": theButton] var constraints:NSMutableArray = NSMutableArray() //横方向の制限 //ボタン真ん中に var constraintFormat1:[AnyObject] = NSLayoutConstraint.constraintsWithVisualFormat( "H:|-[theButton]-|", options : NSLayoutFormatOptions(0), metrics: nil, views: viewDictionary) constraints.addObjectsFromArray(constraintFormat1) aWindow.contentView.addConstraints(constraints) //テーブルビューを作成 //まずはスクロールビュー var scrollView : NSScrollView = NSScrollView(frame: NSMakeRect(0.0,30.0,300.0,170.0)) //中身のテーブルビュー var theTableView : CustomTableView = CustomTableView(frame: NSMakeRect(0.0,30.0,300.0,170.0)) //列 var tableColumn1 : NSTableColumn = NSTableColumn(identifier: "col1") var tableColumn2 : NSTableColumn = NSTableColumn(identifier: "col2") tableColumn1.width = 170 tableColumn2.width = 130 //列をテーブルにセット theTableView.addTableColumn(tableColumn1) theTableView.addTableColumn(tableColumn2) //データソースとデリゲートをセット var dataObj : TableData066 = TableData066() dataArray.addObject(dataObj) theTableView.setDataSource(dataObj ) theTableView.setDelegate(dataObj ) theTableView.reloadData() scrollView.documentView = theTableView scrollView.hasVerticalRuler = true aWindow.contentView.addSubview(scrollView) //テーブルの制約設定 //スクロールビューの制約を手動に scrollView.translatesAutoresizingMaskIntoConstraints = false //ウインドウに対するスクロールビューの制約 var scrollViewConstraints : NSMutableArray = NSMutableArray() var viewDictionary3 : Dictionary = ["scrollView": scrollView] var scrollViewConstraintV:[AnyObject] = NSLayoutConstraint.constraintsWithVisualFormat( "V:|-(11)-[scrollView]-(20)-|", options : NSLayoutFormatOptions(0), metrics: nil, views: viewDictionary3) scrollViewConstraints.addObjectsFromArray(scrollViewConstraintV) //横の制約 スクロールビューが親ビューに対して var scrollViewConstraintH:[AnyObject] = NSLayoutConstraint.constraintsWithVisualFormat( "H:|-(11)-[scrollView]-(20)-|", options : NSLayoutFormatOptions(0), metrics: nil, views: viewDictionary3) scrollViewConstraints.addObjectsFromArray(scrollViewConstraintH) //ウインドウに対するスクロールビューの制約の追加 aWindow.contentView.addConstraints(scrollViewConstraints) //ウインドウの表示 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }