ios 经常用到的一些 API

2018-10-18  本文已影响0人  宁静世界

//屏幕宽度
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: "_")
上一篇下一篇

猜你喜欢

热点阅读