macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

initWithMovie:

ムービーのポインタからNSMovieを初期化して返します
-(id)initWithMovie:(void *)movie:

解説

ムービーのポインタからNSMovieを初期化して返します。
10.5以降はQTKitを使ってください。

返り値

( id )

ムービー

引数

( void * )movie

ムービー

フレームワーク

ApplicationKit

クラス

NSMovie

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject
- (IBAction)act:(id)sender;//アクション
{
    NSLog([[NSMovie movieUnfilteredFileTypes] description]);
    

}
- (IBAction)setMov:(id)sender//ムービーをセット
{
    //開けるファイル拡張子の配列
    NSArray      *imgTypes    = [NSMovie movieUnfilteredFileTypes];
        //OpenPanelを作る
    NSOpenPanel  *opPanel       = [ NSOpenPanel openPanel ];
    //OpenPanelの結果のボタン番号
    int		  opRet;
    //ムービーのURL
    NSURL *movUrl ;
    //ムービー
    NSMovie *theMovie;
    void *mPointer;
    NSMovie *qtmov;
        //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];
        mPointer = [[myOutlet movie] QTMovie];
        
        qtmov = [[[NSMovie alloc] initWithMovie:mPointer] autorelease];
        [myOutlet setMovie:qtmov];
            }
}

@end