UIColorPickerViewController color selection

1.2k Views Asked by At

I have added the UIColorPickerViewController into my code like this:

@IBAction func colorPickerButtonTapped() {
    let colorPicker = UIColorPickerViewController()
    colorPicker.delegate = self
    present(colorPicker, animated: true, completion: nil)
}

func colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) {
    // view.backgroundColor = viewController.selectedColor
}

func colorPickerViewControllerDidFinish(_ viewController: UIColorPickerViewController) {
    // view.backgroundColor = viewController.selectedColor
}

Is there a way I can customize the colors that the user can select?

For example, if I want to allow my users to choose only gray-scale values, or only certain specific colors from my app color palette, is that possible with UIColorPickerViewController?

0

There are 0 best solutions below