论坛首页 移动开发技术论坛

NSArray转为NSMutableArray

浏览 5318 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2010-09-15  
iOS
NSDictionary *names;
NSMutableArray *keys;  


NSString *path = [[NSBundle mainBundle] pathForResource:@"sortednames" ofType:@"plist"];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
names = dict;
   
NSMutableArray *array;
[array setArray:[[names allKeys] sortedArrayUsingSelector:@selector(compare:)]];
self.keys = array;
 

 

參考:

 

setArray:
Sets the receiver’s elements to those in another given array.

- (void)setArray:(NSArray *)otherArray

Parameters
otherArray
The array of objects with which to replace the receiver's content.


论坛首页 移动开发技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics