码迷,mamicode.com
首页 >  
搜索关键字:pathforresource    ( 126个结果
plist文件的读写
读取方法//获得plist文件的路径NSString*plistPath=[[NSBundlemainBundle]pathForResource:@"SearchHistory"ofType:@"plist"];//从路径中读取文件,取决于你的plist文件里的属性_historyArray=[[NSMutableArrayalloc]initWithContentsOfFile:plistPath];写入方法//获得plist文..
分类:其他好文   时间:2015-03-20 01:37:30    阅读次数:128
NSBundle 的理解和 mainBundle 类方法详解
常看到类似的 NSString *file = [[NSBundle mainBundle] pathForResource:name ofType:nil];这样的代码,来产生 file 的完全路径。那么它是什么东西呢:先看 NSBundle 类,直接继承NSObject类。这个类的对象,代表了 ...
分类:其他好文   时间:2015-03-08 14:14:04    阅读次数:91
Gif图片的解析
//加载gif 02 03 NSString *filePath = [[NSBundle mainBundle]pathForResource:@"bai3" ofType:@"gif"]; 04 05 NSData *data = [NSData da...
分类:其他好文   时间:2015-02-13 19:50:48    阅读次数:187
【旧事重提】iOS中文件读写
---恢复内容开始---1. 读取文件 (本地 UTF-8编码的文本文件) NSString *filePath = [[NSBundle mainBundle] pathForResource:@"song" ofType:@"json"]; NSString *str =[NSString s....
分类:移动开发   时间:2015-02-07 18:47:21    阅读次数:153
在iphone程序中打开word、execl、pdf等文档
方法一: 用UIWebView就可以了 -(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webView {     NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil];     NSURL *url =...
分类:其他好文   时间:2015-01-29 12:49:34    阅读次数:226
PDF的显示和浏览
方法一:利用webview -(void)loadDocument:(NSString *)documentName inView:(UIWebView *)webView   {       NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil];       N...
分类:其他好文   时间:2015-01-22 09:30:44    阅读次数:182
加载图片三种方式
这里用的是CIImage,同样可以转换成UIImage。内容比较简单,适合初学者。(自己忘记时看看,严禁商业转载) //第一种,从应用程序包中(资源文件)加载图像     NSString * path = [[NSBundle mainBundle] pathForResource:@"1" ofType:@"png"];     NSURL * pathURL = [N...
分类:其他好文   时间:2015-01-21 10:19:57    阅读次数:166
iOS开发里的Bundle是个啥玩意?!
初学iOS开发的同学,不管是自己写的,还是粘贴的代码,或多或少都写过下面的代码[[NSBundlemainBundle]pathForResource:@"someFileName"ofType:@"yourFileExtension"];[YourViewControllerinitWithNib...
分类:移动开发   时间:2015-01-12 17:36:39    阅读次数:181
iOS 自带的base64 编码与解码
在我们项目中需要将一个NSData类型的数据进行base64编码为一个字符串进行传输。这里记录下编码和解码的方式 编码: UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"di1" ofType:@"jpg...
分类:移动开发   时间:2015-01-06 15:36:06    阅读次数:183
NSBundle 的使用
NSBundle 读取图片 plist text NSBundle *mainbundle=[NSBundle mainBundle]; //使mainBundle 对象获取图片的路径 NSString *imagePath=[mainbundle pathForResource:...
分类:其他好文   时间:2014-12-30 18:55:34    阅读次数:118
126条   上一页 1 ... 7 8 9 10 11 ... 13 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!