NSCoder:decodePropertyList
Home 目次>Foundation>NSCoder このサイトはこちらに移転しました。

decodePropertyList

プロパティリストをデコードします


-(id) decodePropertyList


【返り値】
   idプロパティリストの辞書


【解説】

プロパティリストをデコードします。



【例文】


#import "MyView.h"

@implementation MyView

// アンアーカイブするときの手順の記述
- (
id )initWithCoder:(NSCoder *)decoder
{
//NSPoint point;
//NSRect rect;
//NSSize size;
void *mPointer;
unsigned bBuffer;
NSData *dat2 = [[NSData alloc] init];
NSMutableDictionary *aMutableDictionary = [ NSMutableDictionary dictionaryWithCapacity:
1 ];
NSZone *zone = [
self zone];

intVal =
20 ;
boolVal =
NO ;
NSLog(
@"initWithCoder" );
NSLog([NSString stringWithFormat:
@"systemVersion-%u" ,[decoder systemVersion]]);
NSLog([NSString stringWithFormat:
@"systemVersion-%u" ,[decoder versionForClassName: @"NSCoder" ]]);
[decoder setObjectZone:zone];

[
super initWithCoder:decoder];
mPointer = [decoder decodeBytesWithReturnedLength:&bBuffer];
dat2 = [decoder decodeDataObject];
aMutableDictionary = [decoder decodePropertyList];
NSLog([aMutableDictionary description]);

return self ;
}
// アーカイブするときの手順の記述
- (
void )encodeWithCoder:(NSCoder *)encoder
{
//NSMutableData *dat = [NSMutableData data];
NSLog(
@"encodeWithCoder" );
intVal =
10 ;
boolVal =
YES ;

unsigned char aBuffer[ 100 ];
NSString *str =
@"This is a pen." ;
NSData *dat1 = [NSData dataWithBytes:[str cString]
length:[str cStringLength]];
NSZone *zone;
NSDictionary *dic =
[NSDictionary dictionaryWithObjectsAndKeys:
@"a" , @" " ,
@"i" , @" " ,
@"u" , @" " , nil ];

[dat1 getBytes:aBuffer length:
10 ];
zone = [encoder objectZone];
NSLog(NSZoneName(zone));




[
super encodeWithCoder:encoder];
[encoder encodeBytes:aBuffer length:
10 ];
[encoder encodeDataObject:dat1];
[encoder encodePropertyList:dic];




return ;
}
@end


(C) 2000-2009 Satoshi Oomori.
[Apple]

Google
Webwww.oomori.com
Apple_Store_40x120

[ad:Usual day in Japan]

この記事を評価してください。 

良い 

間違いがある 説明がわかりにくい 例文がわかりにくい  

Home 目次>Foundation>NSCoder
修正日2007.3.22