iphone之--NSBundle
来源:互联网 发布:配置windows 还原更改 编辑:程序博客网 时间:2024/06/09 15:26
http://www.cnblogs.com/xiaodao/archive/2012/07/03/2574703.html
1.获取app的info.plist详细信息
版本号:Bundle version
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
应用标识:Bundle identifier
NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
应用名称:Bundle display name
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
Bundle name
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
2.应用程序语言本地化
app本地化宏
#define XLocalizedString(key, comment) [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
中英文两个Localizable.strings文件中键值对,例如
"none" = "确定";
"none" = "none";
宏的用法:(返回NSString *)
localizedString("none", "这是注释")
3.获取包内文件路径和文件
获取app包路径
NSString *path = [[NSBundle mainBundle] bundlePath];
app资源目录路径
NSString *resPath = [[NSBundle mainBundle] resourcePath];
获取资源目录下a.bundle
NSString* path = [resPath stringByAppendingPathComponent:@"a.bundle"];NSBundle *bundle = [NSBundle bundleWithPath:path];
获取app包的readme.txt文件路径
NSString *path = [[NSBundle mainBundle] pathForResource:@"readme" ofType:@"txt"];
0 0
- iphone之--NSBundle
- Iphone之NSBundle
- Iphone之NSBundle
- Iphone之NSBundle
- IPhone之NSBundle的使用
- IPhone之NSBundle的使用
- iphone -- NSBundle
- iphone -- NSBundle
- iPhone开发成长之路:NSBundle方法详解
- iPhone NSBundle 用法
- iOS开发区之NSBundle
- IOS之NSBundle
- iOS之NSBundle使用
- iOS之NSBundle使用
- IOS 之 NSBundle 使用
- IOS 之 NSBundle 使用
- IOS 之 NSBundle 使用
- iOS之NSBundle简介
- 【Spring】AOP - 面向切面
- 《开源框架那些事儿21》:巧借力与借巧力
- C++ Virtual详解
- 【Zendstudio】如何利用zendstudio新建 或导入php项目
- Nginx 1.9.2新特性
- iphone之--NSBundle
- webHttpBinding、basicHttpBinding和wsHttpBinding区别
- 什么理论?对我又没好处(3)
- 12、less命令
- 如何配置自己的台式机
- 博科SAN交换机学习笔记之二:配置文件备份与固件升级 作者 LiaoJL | 转载时请务必以超链接形式标明文章原文链接和作者信息及本版权声明。 原文链接:http://www.liaojl.co
- 通过Src下载图片存到指定文件夹
- iOS开发-ios7下拉刷新,上提加载快速集成
- 日经社説 20150706 科学技術力を外交に生かそう