coerceToDescriptorType:
指定したデスクリプタタイプで値を強制変換します
-(NSAppleEventDescriptor *)coerceToDescriptorType:(DescType)descType:
解説
指定したデスクリプタタイプで値を強制変換します。
【DescType】
● typeBoolean BOOL値
● typeEnumerated enum値
● typeSInt32 32ビットShort値
● typeType 四文字コード
返り値
( NSAppleEventDescriptor * )
アップルイベントデスクリプタ
引数
( DescType )descType
デスクリプタタイプ
フレームワーク
Foundation
クラス
NSAppleEventDescriptor
Instance Methods
使用可能
10.0
参照
例文
#import "Controller.h" //mi @implementation Controller - (IBAction)pushButton:(id)sender { int intData = 1234; NSData *data; NSString *str = @"This is a pen."; NSData *dat1 = [NSData dataWithBytes:[str cString] length:[str cStringLength]]; NSAppleEventDescriptor *aeDesc= [NSAppleEventDescriptor descriptorWithDescriptorType:typeInteger data:dat1]; //デスクリプタ変換 NSAppleEventDescriptor *aeDesc2 = [aeDesc coerceToDescriptorType:typeFloat]; data = [aeDesc2 data ]; NSLog([data description]); } @end