***** 修改
针对 UITextField , UIWebView 系统自带 在选择一段文字后 ,有 “拷贝”,“选择”,“分享” 等 菜单, 现在要修改
例如 : UITextField
func myMenu() {
print(textField.text(in: textField.selectedTextRange!))
/* 如果是webView
webView.evaluateJavaScript("getSelection().toString()", completionHandler: { (result, error) in
if result != nil {
print("selecter:"+(result as! String) );
} else {
}
})
*/
}
var textField:UITextField!;
override func viewDidLoad() {
super.viewDidLoad()
textField = UITextField(frame: CGRect(x: 20, y: 80, width: 100, height: 80));
textField.text = "sdfassdf sdf sdf sdf s dfs