ios 经常用到的一些 API


//屏幕宽度
let YYScreenWidth = UIScreen.main.bounds.size.width
//屏幕高度
let YYScreenHeigth = UIScreen.main.bounds.size.height
//状态栏高度
let YYStatusBarHeight = UIApplication.shared.statusBarFrame.height
//获取tabbar 高度
let tabBarHeight = self.tabBarController?.tabBar.bounds.size.height
//字符串截取
(str1 as! NSString).substring(to: 260)
//去除首尾空格
text = text.trimmingCharacters(in: .whitespaces)
//去除所有空格
text = text.replacingOccurrences(of: " ", with: "", options: .literal, range: nil)
//判断是否包含
data.display_name.lowercased().contains(inputSearchText!.lowercased())
//比较是否相等
str1.lowercased().compare(str2.lowercased()).rawValue==0
//切割为数组
str1.components(separatedBy: "_")
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。