天天看點

iOS URL encode與decode 筆記

  • Encode:
NSString *url = @"http://haocold.com?location=中國";
[url stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
NSURL *URL = [NSURL URLWithString:url];      
  • Decode:
NSString *url = URL.absoluteString;
url = [url stringByRemovingPercentEncoding];
      

一款輕量級的布局架構,自動布局