// NSData NSDate NSString NSArray NSDictionary json NSString *string = @"hello word"; NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; NSArray *array = [NSArray arrayWithObjects:@"1",@"2",@"3",nil]; N…
//    NSData  NSDate NSString NSArray NSDictionary json NSString *string = @"hello word"; NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; NSArray *array = [NSArray arrayWithObjects:@"1",@"2",@"3",nil…
Fouandation 中常见的理解错误区 1.NSString //快速创建(实例和类方法) 存放的地址是 常量区 NSString * string1 = [NSString alloc]initWithString:@“123”]; NSString * string3 = [NSString stringWithString:@“123”]; //格式化方法创建   存放地址是堆区 NSString * string2 = [NSString alloc]initWithFormat:@…
1.NSDictionary类型转换为NSData类型: NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: @"balance", @"key", @"remaining balance", @"label", @"45", @"value", @"USD", @"curre…
1,NSData 与 NSString NSData --> NSString NSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString --> NSData NSString *aString = @"1234"; NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncod…
,NSData 与 NSString NSData --> NSString NSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString --> NSData NSString *aString = "; NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncoding]; ,NSDat…
查询地址:http://iosdevelopertips.com/data-file-management/read-and-write-nsarray-nsdictionary-and-nsset-to-a-file.html With just a few lines of code, you can read/write collections to/from files. The code below shows examples for writing and reading both…
Xcode4.4(LLVM4.0编译器)中NSArray, NSDictionary, NSNumber优化写法 从xcode4.4开始,LLVM4.0编译器为Objective-C添加一些新的特性.创建数组NSArray,字典NSDictionary, 数值对象NSNumber时,可以像NSString的初始化一样简单方便.妈妈再也不担心程序写得手发酸了. A.   NSArray 首先是非常常用的NSArray,NSMutableArray.NSArray是一个初始化后就固定的静态数组.如果…
// 字符串转Data NSString *str =@"jesfds"; NSData *data =[str dataUsingEncoding:NSUTF8StringEncoding]; //NSData 转NSString NSString *result =[[ NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; //data 转char NSData *data; char *test=[da…
iOS中,将NSData转NSString的一般方法为[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];但是当data中包含00时,所获得的新字符就会为nil,这时我们应该这样转 [NSString stringWithUTF8String:[data bytes]];…