#import"ViewController.h"
@interfaceViewController()
@end
@implementationViewController
- (void)viewDidLoad {
[superviewDidLoad];
//1.全国省市区.plist
NSString*path = [[NSBundlemainBundle]pathForResource:@"1.全国省市区"ofType:@"plist"];
NSArray*arr =[NSArrayarrayWithContentsOfFile:path];
for(NSDictionary*dickeyinarr) {
NSLog(@"%@",dickey[@"State"]);
NSArray*arr1 = dickey[@"Cities"];
for(NSDictionary*diccityinarr1) {
NSLog(@"%@",diccity[@"city"]);
}
}
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
2.只包含地级市.plist
#import"ViewController.h"
@interfaceViewController()
@end
@implementationViewController
- (void)viewDidLoad {
[superviewDidLoad];
//2.只包含地级市.plist
NSString*path = [[NSBundlemainBundle]pathForResource:@"2.只包含地级市"ofType:@"plist"];
NSArray*arr = [NSArrayarrayWithContentsOfFile:path];
for(NSString*strinarr) {
NSLog(@"%@",str);
}
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
3.按首字母排序的地级市.plist
#import"ViewController.h"
@interfaceViewController ()
@end
@implementationViewController
- (void)viewDidLoad {
[superviewDidLoad];
//3.按首字母排序的地级市.plist
NSString *path = [[NSBundle mainBundle] pathForResource:@"3.按首字母排序的地级市"ofType:@"plist"];
NSArray *arr = [NSArray arrayWithContentsOfFile:path];
for(NSDictionary *dickeyinarr) {
NSLog(@"%@",dickey[@"title"]);
NSArray *arrcity = dickey[@"cities"];
for(NSString *strinarrcity) {
NSLog(@"%@",str);
}
}
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
4.包含拼音的市区.plist
#import"ViewController.h"
@interfaceViewController()
@end
@implementationViewController
- (void)viewDidLoad {
[superviewDidLoad];
//4.包含拼音的市区.plist
NSString*path = [[NSBundlemainBundle]pathForResource:@"4.包含拼音的市区"ofType:@"plist"];
NSArray*arr = [NSArrayarrayWithContentsOfFile:path];
for(NSDictionary*dickeyinarr) {
NSLog(@"%@",dickey[@"name"]);
NSLog(@"%@",dickey[@"pinYin"]);
NSLog(@"%@",dickey[@"pinYinHead"]);
NSArray*arrregions = dickey[@"regions"];
for(NSDictionary*dicnameinarrregions) {
NSLog(@"%@",dicname[@"name"]);
}
}
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
网友评论