首页 > 移动平台 > 详细

iOS开发读取plist内容

时间:2015-12-07 00:21:46      阅读:245      评论:0      收藏:0      [点我收藏+]

ios开发中会用到plist保存数据,读取plist数据只需要一行代码就行:

NSArray * appInfos = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"appslist" ofType:@"plist"] 

 [NSBundle mainBundle]会返回当前程序的bundle bundle是什么鬼? 

  调用NSBundle的方法-> pathForResource: @"fileName" ofType:@"fileType"  来获取想要加载的plist的路径

  获取到想要加载的plist的路径后就能调用NSArray 的方法->arrayWithContentsOfFile: @"plistPath" 来读取plist里面的数据

iOS开发读取plist内容

原文:http://www.cnblogs.com/panxiaochun/p/5024602.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!