寫了一個(gè)判斷ios8或者以后版本的邏輯,大家看看有沒(méi)有問(wèn)題?
??
? ? ??let curSystemVersion:String = UIDevice.currentDevice().systemVersion
? ? ? ? let strRange = Range<String.Index>(start:curSystemVersion.startIndex,end:curSystemVersion.endIndex)
? ? ? ? let dotIndex = curSystemVersion.rangeOfString(".", options: NSStringCompareOptions.DiacriticInsensitiveSearch, range: strRange)!
? ? ? ? let iosVersion:Int = curSystemVersion.substringToIndex(dotIndex.startIndex).toInt()!
? ? ? ? if(iosVersion >= 8){
? ? ? ? ? ? return true
? ? ? ? }else{
? ? ? ? ? ? return false
? ? ? ? }
2015-07-05
直接把 "==" 換成 ">=" 就好了 字符串按字典序比大小