encodeConditionalObject:forKey:
キーで条件付きオブジェクトをコード化します
-(void)encodeConditionalObject:(id)object: forKey:(NSString *)key:
解説
キーで条件付きオブジェクトをコード化します。
返り値
( void )
なし
引数
( id )object
オブジェクト
( NSString * )key
キー
フレームワーク
Foundation
クラス
NSCoder
Instance Methods
使用可能
10.2
参照
例文
#import "MyView.h" @implementation MyView //アンアーカイブするときの手順の記述 - (id)initWithCoder:(NSCoder *)decoder { NSLog([[decoder decodeObjectForKey:@"key"] description]); return self; } //アーカイブするときの手順の記述 - (void)encodeWithCoder:(NSCoder *)encoder { [encoder encodeConditionalObject:[[self window] initialFirstResponder] forKey:@"key"]; } @end