2011-07-12 32 views
0

将一堆整数值存储到NSDictionary中可以保存为plist的过程涉及哪些过程?要存储在plist中的字典中的整数值

然后,如何将plist读回到NSDictionary中,然后获取它们的值?

我想存储一堆值,然后在应用程序重新启动时读取它们。

回答

0

,用于存储在字典整数值---

// saves integer as NSString. 
NSString *str = [NSString stringwithformat:@"%d", 234 (integer value)]; 

现在保存上述整数值STR到字典as--

// saves your integer value into dictionary.. 
NSDictionary *dict = [[NSDictionary alloc] setObject:str forkey:@"intervalue"]; 

从NSDictionay检索整数值-----

//got the value in string format 
NSString *str = [dict objectforkey:@"integervalue"]; 

// from this we got the original integer value from the string... 
NSInteger integerValue = [str intValue];