// 当服务端接口没做好时,本地可以构造假数据,并转换为json数据
NSError *error;
NSString *dataStr = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"indEditor" ofType:@"txt"] encoding:NSUTF8Stri...
分类:
移动开发 时间:
2014-12-11 12:31:02
阅读次数:
148
NSBundle一.获取图片1. NSString *path = [[NSBundle mainBundle] pathForResource:@"resourceName" ofType:@“resourceType"]; UIImage *image = [[UIImageimageW...
分类:
其他好文 时间:
2014-12-05 10:32:35
阅读次数:
160
//从budle路径下读取音频文件 轻音乐 - 萨克斯回家 这个文件名是你的歌曲名字,mp3是你的音频格式NSString *string = [[NSBundle mainBundle] pathForResource:@"轻音乐 - 萨克斯回家" ofType:@"mp3"];//把音频文件转....
分类:
其他好文 时间:
2014-12-03 12:06:26
阅读次数:
163
不要用imageNamed用这个方法,内存不会清理的NSString *path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png"];myImage = [UIImage imageWithContentsOfFile:pa...
分类:
其他好文 时间:
2014-11-28 17:58:29
阅读次数:
101
1,本地的html文件一定要放到工程文件的根目录2,html代码中的图片路径一定要是相对路径3,下面是用UIWebView调用本地文件的方法方法一:NSString*filePath = [[NSBundlemainBundle]pathForResource:@"1"ofType:@"html"]...
分类:
移动开发 时间:
2014-11-26 13:54:52
阅读次数:
144
使用JsonKit解析中文时如果返回值为空,可能使用因为计算长度时不准确造成的。
解决方法:
NSString *pricePath = [[NSBundle mainBundle] pathForResource:@"CarSelectPrice" ofType:@"json"];
NSString *priceStr = [[NSString alloc] initWithCont...
分类:
Web程序 时间:
2014-11-22 17:31:50
阅读次数:
152
+(NSDictionary*)readFromArchive:(NSString*)aFileName{NSString*errorDesc=nil;NSPropertyListFormatformat;NSString*plistPath=[[NSBundlemainBundle]pathForResource:aFileNameofType:@"plist"];NSData*plistXML=[[NSFileManagerdefaultManager]contentsAtPath:plistPath];..
分类:
其他好文 时间:
2014-11-19 18:55:22
阅读次数:
86
//1 可读取,不可写入工程下的plist文件;// NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"OfficialDoc" ofType:@"plist"]; //2 Document 沙盒中的文件(没有文件可自...
分类:
移动开发 时间:
2014-11-09 12:32:47
阅读次数:
180
- (IBAction)testLoadHTMLSting:(id)sender {
// 设定主页文件的基本路径
// 文件名为“index.html”
// [NSBundle mainBundle]是为了获取当前项目地址
NSString *htmlPath = [[NSBundle mainBundle]pathForResource:
...
分类:
Web程序 时间:
2014-10-20 10:04:32
阅读次数:
251
1利用NSBundle 取得json文件路径NSString *path=[[NSBundle mainBundle]pathForResource:@"help.json" ofType:nil];2把文件转成NSDataNSData *data=[NSData dataWithContentsO...
分类:
Web程序 时间:
2014-10-09 22:16:17
阅读次数:
169