上周码程序的时候碰到个问题,因为设计上的约束,一个方法接受的参数只能为List<object>类型,然而该方法需要处理的真实数据则是确定的List<Currency>。然而C#不允许显示的直接转换类型,并且两个方向上都不可以操作。这个问题让我爆了一会儿,最后在MSDN上找到了一个OfType<T>的 ...
在处理XML的过程中,在项目中手动创建名为“data.xml”的文件,加入网上找的内容 然后xcode加载data.xml中的内容 执行没有任何结果。 估计原因是elementsForDogs元素个数为0,没有进入for循环。打印elementsForDogs的元素总数,结果真的是0。然后往上查找, ...
分类:
移动开发 时间:
2016-06-16 20:04:43
阅读次数:
1452
/** 本地加载方式加载JS*/ NSString *path = [[NSBundle mainBundle] pathForResource:@"jquery.js" ofType:nil]; NSString *path2 = [[NSBundle mainBundle] pathForRes ...
分类:
Web程序 时间:
2016-06-03 18:55:55
阅读次数:
238
初学iOS开发的同学,不管是自己写的,还是粘贴的代码,或多或少都写过下面的代码 [[NSBundle mainBundle] pathForResource:@"someFileName" ofType:@"yourFileExtension"]; [YourViewController initW ...
分类:
其他好文 时间:
2016-05-25 14:48:26
阅读次数:
126
NSString *path=[[NSBundle mainBundle]pathForResource:@"测试一" ofType:@"docx"]; //获取内容 NSData *data = [[NSData alloc]initWithContentsOfFile:path]; NSStri ...
分类:
Web程序 时间:
2016-04-27 01:45:01
阅读次数:
278
UIWebView加载工程本地网页与本地图片- (void)viewDidLoad{ [super viewDidLoad]; NSString *filePath = [[NSBundle mainBundle]pathForResource:@"1" ofType:@"html"]; NSStr ...
分类:
Web程序 时间:
2016-04-22 18:27:33
阅读次数:
164
1、配置返回的json对象为小写开头 在路由配置里面,Register(HttpConfiguration config)中路由配置下边添加: var jsonFormatter = config.Formatters.OfType<JsonMediaTypeFormatter>().First() ...
分类:
其他好文 时间:
2016-04-15 01:54:05
阅读次数:
184
第一种方法系统自带的解析方法(NSXMLParser) //1、指定XML文件 NSString *path=[[NSBundle mainBundle] pathForResource:@"person" ofType:@"xml"]; //转换成data类型对象 NSData *data=[NS ...
分类:
其他好文 时间:
2016-03-28 23:33:08
阅读次数:
309
NSString *path = [[NSBundle mainBundle] pathForResource:@"ad_type = 4" ofType:@"html"]; NSString *htmlStr = [NSString stringWithContentsOfFile:path en
分类:
Web程序 时间:
2016-03-04 18:58:48
阅读次数:
219
在项目中,经常需要读取配置文件,现在就来看看读取plist配置文件的代码 NSBundle *bundle = [NSBundle mainBundle]; NSString *plistPath = [bundle pathForResource:@"fileName" ofType:@"plis
分类:
移动开发 时间:
2016-03-01 00:52:44
阅读次数:
214