swift 常用的小句代码

swift下URL里中文转码方法

let UTF8Url =  urlStr.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())

字符串去空格

let newText = self.searchTF?.text?.stringByReplacingOccurrencesOfString(" ", withString: "")

直接弹出键盘

override func viewWillAppear(animated: Bool)
    {
        super.viewWillAppear(animated)
        //直接弹出键盘
        self.searchTF?.becomeFirstResponder()
        
    }


你可能感兴趣的:(url,utf-8)