iOS开发 小知识点

1/ iOS汉字百分号互相转换.

//汉字
 NSString * name = @"时间终于将我对你的爱消耗殆尽";
 //汉字转为百分比
 NSString * encodeString = [name stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
 NSLog(@"%@", encodeString); 
//百分比转汉字
encodeString = [encodeString stringByRemovingPercentEncoding]; 
NSLog(@"%@", encodeString);

输出结果:

15:20:04 <ViewController.m> -> 35 :%E6%97%B6%E9%97%B4%E7%BB%88%E4%BA%8E%E5%B0%86%E6%88%91%E5%AF%B9%E4%BD%A0%E7%9A%84%E7%88%B1%E6%B6%88%E8%80%97%E6%AE%86%E5%B0%BD
15:20:04 <ViewController.m> -> 38 :时间终于将我对你的爱消耗殆尽

 

2/ UISearchBar的相关设置:

  http://blog.csdn.net/android_ls/article/details/39993433

posted @ 2017-07-31 12:27  高晓牛  阅读(233)  评论(0编辑  收藏  举报