首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

NSArray转向NSMutableArray

2012-08-25 
NSArray转为NSMutableArrayNSDictionary *namesNSMutableArray *keysNSString *path [[NSBundle mainB

NSArray转为NSMutableArray

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.


热点排行