首页 > 其他 > 详细

Xcode--NSBundle

时间:2014-12-05 10:32:23      阅读:254      评论:0      收藏:0      [点我收藏+]

NSBundle
一.获取图片
  1.   NSString *path = [[NSBundle mainBundle] pathForResource:@"resourceName" ofType:@“resourceType"];
       UIImage *image = [[UIImage imageWithContentsOfFile:path];

  2.   UIImage *image = [UIImage imageNamed:@"imageName"];
二.获取plist文件
  NSArray *array =[[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"name"ofType:@"plist"]];
  NSDictionary *dict=[array objectAtIndex:index];//将plist文件中的内容转换成字典

Xcode--NSBundle

原文:http://www.cnblogs.com/ZhangYuGe/p/4145925.html

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