decodeArrayOfObjCType:count:at:
オブジェクティブCタイプで配列をデコードします
-(void)decodeArrayOfObjCType:(const char *)itemType: count:(NSUInteger)count: at:(void *)address:
解説
オブジェクティブCタイプで配列をデコードします。
返り値
( void )
なし
引数
( const char * )itemType
アイテムタイプ
( NSUInteger )count
カウント
( void * )address
ポインタ
フレームワーク
Foundation
クラス
NSCoder
Instance Methods
使用可能
10.0
参照
- decodeValuesOfObjCTypes:
例文
#import "MyView.h" @implementation MyView //アンアーカイブするときの手順の記述 - (id)initWithCoder:(NSCoder *)decoder { intVal = 20; boolVal = NO; NSLog(@"initWithCoder"); [super initWithCoder:decoder]; [decoder decodeValueOfObjCType:@encode(int) at:&intVal]; NSLog([NSString stringWithFormat:@"intVal = %d",intVal]); [decoder decodeValueOfObjCType:@encode(BOOL) at:&boolVal]; if (boolVal){ NSLog(@"YES"); }else{ NSLog(@"NO"); } [decoder decodeArrayOfObjCType:@encode(float) count:1 at:&floatVal]; return self; } //アーカイブするときの手順の記述 - (void)encodeWithCoder:(NSCoder *)encoder { intVal = 10; boolVal = YES; [super encodeWithCoder:encoder]; [encoder encodeValueOfObjCType:@encode(int) at:&intVal]; [encoder encodeValueOfObjCType:@encode(BOOL) at:&boolVal]; [encoder encodeArrayOfObjCType:@encode(float) count:1 at:&floatVal]; return; } @end