frame
ウインドウのフレーム矩形をスクリーン座標で返します
@property(readonly) NSRect frame
var frame: NSRect { get }
解説
ウインドウのフレーム矩形をスクリーン座標で返します。
返り値
( NSRect )
ウインドウのフレーム矩形
引数
フレームワーク
ApplicationKit
クラス
NSWindow
使用可能
10.0
参照
- screen
- deepestScreen
関連記事(外部サイト)
更新時バージョン
10.10
例文
#import "Controller.h" @implementation Controller - (IBAction)pushButton:(id)sender { NSRect contentRect; contentRect = [myWindow frame]; [info setStringValue:[NSString stringWithFormat:@"%.1f,%.1f,%.1f,%.1f",contentRect.origin.x,contentRect.origin.y,contentRect.size.width,contentRect.size.height]]; } @end
//NSWindow frame @IBAction func function051(sender: AnyObject) { var theWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false) windowArray.addObject(theWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 theWindow.center()//ウインドウをスクリーンの中心に theWindow.title = "ウインドウタイトル"//タイトル設定 theWindow.orderFront(self)//前面に theWindow.makeKeyAndOrderFront(self)//表示 NSLog("x = %.2f,y = %.2f,w = %.2f,h = %.2f", Float(theWindow.frame.origin.x ), Float(theWindow.frame.origin.y), Float(theWindow.frame.size.width), Float(theWindow.frame.size.height)) }