Mise à jour de Swift 3 :
Il semble que Xcode 8/Swift 3 ait apporté UIControlState.normal
arrière :
public struct UIControlState : OptionSet {
public init(rawValue: UInt)
public static var normal: UIControlState { get }
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
}
UIControlState.Normal
a été renommé en UIControlState.normal
et retiré du SDK iOS. Pour les options "normales", utilisez un tableau vide pour construire un ensemble d'options vide.
let btn = UIButton(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
// Does not work
btn.setTitle("title", for: .Normal) // 'Normal' has been renamed to 'normal'
btn.setTitle("title", for: .normal) // 'normal' is unavailable: use [] to construct an empty option set
// Works
btn.setTitle("title", for: [])