通过NSBundle加载plist文件

1.NSBundle
1> 一个NSBundle代表一个文件夹,利用NSBundle能访问对应的文件夹
2> 利用mainBundle就可以访问软件资源包中的任何资源
3> 模拟器应用程序的安装路径
/Users/aplle/资源库/Application Support/iPhone Simulator/7.1/Applications   


       // File : 全路径
       // NSBundle : 一个NSBundle代表一个文件夹

      // 利用mainBundle就可以访问软件资源包中的任何资源
        NSBundle *bundle = [NSBundle mainBundle];
       
        //  获得imageData.plist的全路径
        NSString *path = [bundle pathForResource:@"imageData" ofType:@"plist"];
       
        _imageData = [NSArray arrayWithContentsOfFile:path];

猜你喜欢

转载自invictus-fang.iteye.com/blog/2142983
今日推荐