NSMovieView:movieRect
Home 目次>ApplicationKit>NSMovieView

movieRect

ムービーの矩形を返します


-(NSRect) movieRect


【返り値】
   NSRect範囲


【解説】

ムービーの矩形を返します
初期設定は、ビューのバウンディングボックスです。
違う設定をしたい場合はオーバーライドします。
10.5以降はQTKitを使ってください。



【例文】


#import "MyObject.h"
//myOutletはMovieView
@implementation MyObject
- (IBAction)act:(id)sender;//アクション
{
NSRect rect = [myOutlet movieRect];

NSLog([NSString stringWithFormat:@"%.1f,%.1f,%.1f,%.1f",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height]);

}
- (IBAction)setMov:(id)sender//ムービーをセット
{
//開けるファイル拡張子の配列
NSArray *imgTypes = [ NSArray arrayWithObjects : @"mov",@"movie",nil ];
//OpenPanelを作る
NSOpenPanel *opPanel = [ NSOpenPanel openPanel ];
//OpenPanelの結果のボタン番号
int opRet;
//ムービーのURL
NSURL *movUrl ;
//ムービー
NSMovie *theMovie;

//OpenPanelでファイル選択
opRet = [ opPanel runModalForDirectory : NSHomeDirectory() //どこのディレクトリを出すか
file : @"Movies" //どのどのファイルを選択しておくか
types : imgTypes ];//選べるファイルタイプ

if ( opRet == NSOKButton ) { // OPENPanelのボタンがOKなら
//NSImageを作ってファイルから読み込む
movUrl = [NSURL fileURLWithPath:[ opPanel filename ]];
theMovie = [[NSMovie alloc] initWithURL:movUrl byReference:YES];
[myOutlet setMovie:theMovie];
}
}

@end


(C) 2000-2007 Satoshi Oomori.
[Apple]

Google
Webwww.oomori.com
Apple_Store_40x120

[ad:Usual day in Japan]

この記事を評価してください。 

良い 

間違いがある 説明がわかりにくい 例文がわかりにくい  

Home 目次>ApplicationKit>NSMovieView
修正日2006.12.26