1.获取路径 2.将路径转换成数据data 3.将数据转换成字典
- (void)createData{
NSString *path = @"/Users/dllo/Desktop/UI09_本地豆瓣电影/UI09_本地豆瓣电影/movielist.txt";
NSData *data = [NSData dataWithContentsOfFile:path];
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
// NSLog(@"%@",dic);
self.movieArr = dic[@"result"];
NSLog(@"%@", self.movieArr);
}
怎么加载本地数据中的图片??
1.引头文件"UIImageView + WebCache.h"(这是类目)
2.Build Phases中搜索sd, 全选在框里输入-fobjc-arc..............引入三方需要将mac改成arc
然后再info.plist中点open as 打开source code,在当中添加一段代码
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
这样就可以用网络中给的地址图片
在自定义的cell中,一定记得把坐标设好,如果超过,会引起很多问题!!!!!!!