contentView
引き出しの内容ビューを返します
@property(strong) NSView *contentViewvar contentView: NSView?
解説
引き出しの内容ビューを返します。
設定値
内容ビュー
Objective-C@property(strong) NSView *contentViewvar contentView: NSView?
フレームワーク
ApplicationKit
クラス
NSDrawer
使用可能
10.0
参照
更新時のバージョン
OS X 10.10.2
関連記事(外部サイト)
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction1:(id)sender { [drawer open]; [drawer setContentSize:NSMakeSize(50,50)]; NSLog([[drawer contentView] className]); } - (IBAction)myAction2:(id)sender { [drawer close]; } @end
//NSDrawer contentSize //NSDrawer leadingOffset //NSDrawer maxContentSize //NSDrawer minContentSize //NSDrawer trailingOffset //NSDrawer contentView var theDrawer006 : NSDrawer = NSDrawer(contentSize: NSMakeSize(100.0, 100.0), preferredEdge: 1 ) //preferredEdge 0=左、1=下、2=右、3=上 func buttonAction006(sender: AnyObject){ var theWindow : NSWindow = (sender as NSButton).window! //drawerを表示/非表示 theDrawer006.toggle(theWindow) NSLog("size = (%.2f,%.2f)", Float(theDrawer006.contentSize.width),Float(theDrawer006.contentSize.height)) NSLog("leadingOffset = (%.2f)", Float(theDrawer006.leadingOffset)) NSLog("maxContentSize = (%.2f,%.2f)", Float(theDrawer006.maxContentSize.width),Float(theDrawer006.maxContentSize.height)) NSLog("minContentSize = (%.2f,%.2f)", Float(theDrawer006.minContentSize.width),Float(theDrawer006.minContentSize.height)) NSLog("trailingOffset = (%.2f)", Float(theDrawer006.trailingOffset)) NSLog("contentView = %@", theDrawer006.contentView!.description ) } @IBAction func function006(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 = "Toggle" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction006:") theButton.target = self aWindow.contentView.addSubview(theButton) let delegateObj : DrawerDelegate = DrawerDelegate() delegateObjects.addObject(delegateObj) theDrawer006.delegate = delegateObj //NSLog("delegate = %@",delegateObj) let cView : NSView = NSView(frame: NSMakeRect(10.0, 10.0, 100.0, 100.0)) theDrawer006.contentView?.addSubview(cView) //テキストフィールドを作成、引き出しに付ける var textField : NSTextField = NSTextField(frame: NSMakeRect(10.0, 10.0, 50.0, 30.0)) cView.addSubview(textField) //引き出しのウインドウを設定 theDrawer006.parentWindow = aWindow //ウインドウの表示 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }