macOS/iOS API解説

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

目次

initWithPasteboard:

ペーストボードからサウンドオブジェクトを初期化して返します
-(id)initWithPasteboard:(NSPasteboard *)pasteboard:

解説

ペーストボードからサウンドオブジェクトを初期化して返します。

返り値

( id )

サウンド

引数

( NSPasteboard * )pasteboard

ペーストボード

フレームワーク

ApplicationKit

クラス

NSSound

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"
//未
@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSSound *mySound = [NSSound soundNamed : @"Basso"];
NSSound *snd ;

[[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObjects: NSSoundPboardType, nil] owner:self];

[mySound writeToPasteboard:[NSPasteboard generalPasteboard]];

    if ([NSSound canInitWithPasteboard:[NSPasteboard generalPasteboard]]){
        snd = [[NSSound alloc] initWithPasteboard:[NSPasteboard generalPasteboard]];
        [snd play];
        NSLog(@"YES");
    }else{
        NSLog(@"NO");
    }
}

@end