键盘输入模式获取和语言获取
//键盘输入模式获取
let lang = textFeild.textInputMode?.primaryLanguage
获取输入框中的高亮部分
let markedRange = textFeild.markedTextRange
截取到指定位置的字符串
newText?.substring(to: (newText?.index((newText?.startIndex)!, offsetBy:maxLen))!)
获取image的宽度
OC
CGFloat imageWidth = CGImageGetWidth([_leftLogPicture.image CGImage]);
Swift
let imageWidth = (leftLogPicture?.image?.cgImage)!.width