animationResizeTime:
ウインドウをリサイズするときのアニメーションの速度を返します
- (NSTimeInterval)animationResizeTime:(NSRect)newWindowFrame
func animationResizeTime(_ newWindowFrame: NSRect) -> NSTimeInterval
解説
ウインドウをリサイズするときのアニメーションの速度を返します。
サブクラスでオーバーライドして、アニメーションの速度を制御する事が出来ます。
デフォルトの速度は、1秒間に150ピクセルになっていますが、別のバージョンでは変わる可能性があります。
フレームワーク
ApplicationKit
クラス
NSWindow
使用可能
10.0
参照
例文
#import "Controller.h" @implementation Controller - (IBAction)pushButton:(id)sender { NSLog([NSString stringWithFormat:@"%f",[myWindow animationResizeTime:NSMakeRect(0,0,300,300)]]); } @end
//NSWindow setFrame:animate: //NSWindow animationResizeTime: func buttonAction057(sender: AnyObject){ var theWindow : NSWindow = (sender as NSButton).window! var animeTime : NSTimeInterval = theWindow.animationResizeTime(NSMakeRect(100.0, 100.0, 500.0, 300.0)) NSLog("animeTime = %.2f sec",animeTime) theWindow.setFrame(NSMakeRect(100.0, 100.0, 500.0, 300.0), display: true ,animate: true) 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)) } @IBAction func function057(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 = "Action" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction057:") theButton.target = self aWindow.contentView.addSubview(theButton) //ウインドウの表示 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "ウインドウタイトル"//タイトル設定 aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }