UIControlState.Normal is Unavailable
Swift 3 update:
It appears that Xcode 8/Swift 3 brought UIControlState.normal
back:
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
has been renamed to UIControlState.normal
and removed from the iOS SDK. For "Normal" options, use an empty array to construct an empty option set.
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: [])
UIControlState.Normal is Unavailable
Swift 3 update:
It appears that Xcode 8/Swift 3 brought UIControlState.normal
back:
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
has been renamed to UIControlState.normal
and removed from the iOS SDK. For "Normal" options, use an empty array to construct an empty option set.
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: [])
setTitle(_ title: String?, for state: UIControlState) where is .Normal state?
Like any other option set:
button.setTitle("", for: [])
where []
stands for .normal
(the value of .normal
is 0
).
Note that we can use multiple states in one call:
button.setTitle("", for: [.selected, .disabled])
That's why UIControlState
has been changed into an option set.
Alertview when song is unavailable
Try
if( q.items.count < 1 ) {
[self showAlert];
return;
}
before
[self.player setQueueWithQuery: q]
Using NSUserDefaults with Xcode 8 and iOS 10
NSUserDefaults
has been renamed to UserDefaults
. standardUserDefaults()
has been renamed to standard()
.
let defaults = UserDefaults.standard
This now works.
Pre-release documentation link.
Related Topics
How to Change a Swiftui Color to Uicolor
Will Push Notification Still Work After Ownership Transfer in Itunesconnect
How to Query Nearest Users in Firebase with Swift
Thread 1:Exc_Bad_Access (Code = 1, Address = 0X30000008)
Fbsession.Activesession.Isopen Returns No Even Though the User Logged-In
API Facebook iPhone , Possible to Post to a Friend's Wall
Using Private API to Read Wifi Rssi Value
Image in Tableviewcell Swipe Action
How to Find Serial Number, Imei Number Using iOS Sdk
Add Uitapgesturerecognizer to Uitextview Without Blocking Textview Touches
How to Programmatically Get iOS's Alphanumeric Version String
How to Release an Mtaudioprocessingtap
Calling Instance Method During Initialization in Swift
Ios: Helpfulness of Didreceivememorywarning:
Load a .Tmx (Tiled Map) in Sprite Kit
Get Cellid, Mcc, Mnc, Lac, Signal Strength, Quality and Network in iOS 8.3
How to Get Assets.Xcassets File Names in an Array (Or Some Data Structure)