IOS-项目总结(二)

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);
————————————————
版权声明:本文为CSDN博主「LangJvci」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/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]];

 

 

你可能感兴趣的:(IOS)