一 插件简介:其github地址:https://github.com/li6185377/LKDBHelper-SQLite-ORM全面支持 NSArray,NSDictionary, ModelClass, NSNumber, NSString, NSDate, NSData, UIColor,...
分类:
移动开发 时间:
2015-05-22 16:32:31
阅读次数:
1226
//第一步:保存头像信息到NSData中 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); self.documentsPath = [pat...
分类:
其他好文 时间:
2015-05-22 13:11:40
阅读次数:
165
当使用重用机制的cell中的imageView下载图片时不能通过以下代码直接获取:NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlStr]];cell.imageView.image = [UIImage im...
分类:
其他好文 时间:
2015-05-20 22:10:31
阅读次数:
135
场景:MK网络请求,后台返回有数据,但是因为json数据中某些字段有换行符无法解析,即json格式错误,如果后台不给转码,就需要自己解决,\r\n是ASCII码表中的换行符,将这些字段忽略掉基本就没有问题了
NSString *resultString = [self responseString];//self为网络请求操作类(completedOperation)
NSData *data ...
分类:
移动开发 时间:
2015-05-18 13:02:08
阅读次数:
199
#import "NSData+MimeType.h"@implementation NSData (MimeType)-(NSString *)mimeType{ uint8_t c; [self getBytes:&c length:1]; NSString *mimeType=nil; ...
分类:
其他好文 时间:
2015-05-15 15:05:27
阅读次数:
109
我们在编码中,很多时候需要将C里面原生的数据封装成对象,这样可以用NSDictionary或者NSArray来存取访问。尤其是一些做适配的情况下,这种封装是不可避免的。Objective-C提供了不少类可以帮助我们,比较常见的是NSNumber,NSValue和NSData。NSNumber主要是用...
分类:
其他好文 时间:
2015-05-13 16:11:58
阅读次数:
133
之前自己写了NSDictionary转化为NSData的一种方法如下 NSMutableData *data = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWr....
分类:
其他好文 时间:
2015-05-06 12:59:14
阅读次数:
112
iOS的图片压缩,目前我在用的有两种:一、在内存中压缩需要消耗内存,如果图片较多,可能会造成crash//压缩图片质量
+(UIImage*)reduceImage:(UIImage*)p_w_picpathpercent:(float)percent
{
NSData*p_w_picpathData=UIImageJPEGRepresentation(p_w_picpath,percent);
UIImage*..
分类:
移动开发 时间:
2015-05-04 22:23:23
阅读次数:
202
一、将NSDictionary或NSArray转化为JSON串// 将字典或者数组转化为JSON串 NSData*jsonData=[NSJSONSerializationdataWithJSONObject:array options:NSJSONWritingPrettyPrinted erro...
分类:
Web程序 时间:
2015-05-02 23:17:07
阅读次数:
141
//封装的转换方法,直接传入你需要转换的数据
- (NSString *)getJsonFromData:(id)sender
{
//json对象
NSString *jsonStr;
//将传进来的数据转换为data
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:sender options...
分类:
移动开发 时间:
2015-04-30 12:36:23
阅读次数:
146