Created
August 29, 2020 09:51
-
-
Save ashishkakkad8/657184064170128897d889ec1691e81d to your computer and use it in GitHub Desktop.
UIColorPickerViewController - iOS 14 - A view controller that informs your app about user interaction with the color picker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
@IBAction func btnColorPickerPressed(_ sender: Any) { | |
let colorPickerVC = UIColorPickerViewController() | |
colorPickerVC.delegate = self | |
present(colorPickerVC, animated: true) { | |
} | |
} | |
} | |
extension ViewController : UIColorPickerViewControllerDelegate { | |
func colorPickerViewControllerDidFinish(_ viewController: UIColorPickerViewController) { | |
} | |
func colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) { | |
self.view.backgroundColor = viewController.selectedColor | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment