【发布时间】:2016-04-21 19:57:28
【问题描述】:
将 Swift 更新到 2.0 后,我需要修复我的代码。自动更正不起作用。
func getValueForKey(key: String) -> CGFloat {
var inch = ""
if screenSize.height == 480 {
// iPhone 4, 4s and below
inch = "3.5"
} else if screenSize.height == 568 {
// iPhone 5, 5s
inch = "4"
} else if screenSize.width == 375 {
// iPhone 6
inch = "4.7"
} else if screenSize.width == 414 {
// iPhone 6+
inch = "5.5"
} else if screenSize.width == 768 {
// iPad
inch = "5.5+"
}
let result = values["\(key)\(inch)"]!
// println("\(key) - \(result)")
return result
}
我已经改了。 但是什么也没发生,它又出现了!
如何解决?
【问题讨论】:
-
hm..它对我有用..它实际上在 CoreGraphics 中声明,尝试重新启动你的 xcode
-
Thx) import UIKit 帮助......我失败了(但它之前工作过......奇怪的事情发生了:D
标签: ios xcode swift swift2 cgfloat