button.backgroundColor = UIColor.blue
Or any other color: red
, green
, yellow
,etc.
Another option is RGBA color:
button.backgroundColor = UIColor(red: 0.4, green: 1.0, blue: 0.2, alpha: 0.5)
More Related Contents:
- How to display and hide table view cells in swift
- By fetching Date using this struct getting nil value even i have manually set date on having nil in swift 3 [duplicate]
- How to determine the current iPhone/device model?
- Pass data through segue
- How to insert new cell into UITableView in Swift
- How to create a button programmatically?
- How to segue programmatically in iOS using Swift
- Navigation Controller Push View Controller
- Detect iOS app entering background
- How can I scan barcodes on iOS? [closed]
- Transparent iOS navigation bar
- Setting an image for a UIButton in code
- Location Services not working in iOS 11
- How to call gesture tap on UIView programmatically in swift
- How to detect one button in tableview cell
- How to change UISearchBar Placeholder and image tint color?
- SwiftUI List color background
- Check if UIColor is dark or bright?
- How can I color a UIImage in Swift?
- How to change the tint color of the clear button on a UITextField
- How do I set UIButton background color forState: UIControlState.Highlighted in Swift
- UITableViewCell Buttons with action
- Show iPhone cut copy paste menu on UILabel
- How to remove border of the navigationBar in swift?
- Creating thumbnail from local video in swift
- How to get the front camera in Swift?
- How to scroll to a particluar index in collection view in swift
- How to use NSUnderlineStyle.PatternDot
- Tap Gesture on animating UIView not working
- How can I do programmatically gradient border color UIButton with Swift [closed]