一,工程图。

【代码笔记】iOS-plist获得城市列表

二,代码。

【代码笔记】iOS-plist获得城市列表
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    
    NSString* cityPlistPath = [[NSBundle mainBundle] pathForResource:@"cities" ofType:@"plist"];
    
    //按照拼写排序,spell是英文拼写
    NSSortDescriptor *bySpell  = [NSSortDescriptor sortDescriptorWithKey:@"spell" ascending:YES];
    NSArray *cities = [[NSArray arrayWithContentsOfFile:cityPlistPath] sortedArrayUsingDescriptors:@[bySpell]];
    NSLog(@"--cities--%@",cities);
    
}
【代码笔记】iOS-plist获得城市列表

相关文章:

  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
  • 2021-06-24
相关资源
相似解决方案