关闭

归档

129人阅读 评论(0) 收藏 举报
NSArray *myArray1;
NSArray *myArray2;
NSMutableString *tmpStr;
NSMutableString *string1;
NSMutableString *string2;
NSMutableString *string3;
NSData *buffer;


string1 = [NSMutableString stringWithString: @"Red"];
string2 = [NSMutableString stringWithString: @"Green"];
string3 = [NSMutableString stringWithString: @"Blue"];

myArray1 = [NSMutableArray arrayWithObjects: string1, string2, string3, nil];

buffer = [NSKeyedArchiver archivedDataWithRootObject: myArray1];
myArray2 = [NSKeyedUnarchiver unarchiveObjectWithData: buffer];

tmpStr = [myArray1 objectAtIndex: 0];

[tmpStr setString: @"Yellow"];

NSLog (@"First element of myArray1 = %@", [myArray1 objectAtIndex: 0]);

NSLog (@"First element of myArray2 = %@", [myArray2 objectAtIndex: 0]);


转载 http://hi.baidu.com/lphack/blog/item/798c65177fd4c74ff3de3282.html


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:61976次
    • 积分:1141
    • 等级:
    • 排名:千里之外
    • 原创:49篇
    • 转载:37篇
    • 译文:2篇
    • 评论:0条