1、字典、数组
// 创建数组
NSArray *arr = [NSArray arrayWithObjects:@"a", @"b", @"c", nil];
// 创建字典
NSDictionary *dic = [NSDictionar dictionaryWithObjectsAndKeys:@"1",@"a",@"2", @"b", nil];
// // 1.数组套数组
// NSArray *arr1 = [NSArray arrayWithObjects:arr, @"adsf", nil];
// NSLog(@"arr1 %@", arr1);
// // 2.字典套字典
// NSDictionary *dic2 = [NSDictionary dictionaryWithObjectsAndKeys:@"1", @"a", dic, @"dictionary", nil];
// NSLog(@"dic2 %@", dic2);
// // 3.数组套字典
// NSArray *arr3 = [NSArray arrayWithObjects:arr, arr1, dic2, nil];
// NSLog(@"arr3 %@", arr3);
// // 4.字典套数组
// NSDictionary *dic4 = [NSDictionary dictionaryWithObjectsAndKeys:arr3, @"remix", @"qwer", @"lol", nil];
// NSLog(@"dic4 %@", dic4);
————————————————
版权声明:本文为优快云博主「LangJvci」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/LangJvci/article/details/43989911
2、we bview中带中文处理,转码
NSString*hStr =@"你好啊到底";
NSString*hString = [hStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"hString === %@",hString);
这样会有警告(stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -...),在iOS9.0中,该方法已经被另一个方法替代了,改为如下:
NSString*hString = [hStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
本文详细介绍了在Objective-C中如何使用数组和字典进行数据结构操作,包括数组和字典的嵌套使用,以及如何对字符串进行URL编码处理,以适应网络请求中的中文字符传输。
1431

被折叠的 条评论
为什么被折叠?



