我在 Xcode 8 上使用 iOS10 将我的应用程序更新到 Swift 3,但出现以下错误:
Btn.setTitle('str', forState: .Normal)
.Normal 不再是 UIControlState 的枚举类型。我应该为这种状态使用哪种类型的 UIControlState?
苹果枚举现在定义为
public struct UIControlState : OptionSet {
public init(rawValue: UInt)
public static var highlighted: UIControlState { get } // used when UIControl isHighlighted is set
public static var disabled: UIControlState { get }
public static var selected: UIControlState { get } // flag usable by app (see below)
@available(iOS 9.0, *)
public static var focused: UIControlState { get } // Applicable only when the screen supports focus
public static var application: UIControlState { get } // additional flags available for application use
public static var reserved: UIControlState { get } // flags reserved for internal framework use
}