Color wheel or color picker in iOS

前端 未结 8 657
故里飘歌
故里飘歌 2020-12-31 10:12

How can I make a color wheel, color picker, or hue selector in iOS for use on the iPad.

Here is an example picture of a color picker similar to what I want.

8条回答
  •  不知归路
    2020-12-31 10:35

    You don't need 3rd party code if you target your app to iOS 14. It has the UIColorPickerViewController and it's quite straightforward.

    let picker = UIColorPickerViewController()
    picker.delegate = self
    present(picker, animated: true, completion: nil)
    

    You can set the intitial selectedColor, or change supportsAlpha to false to hide the alpha slider and only allow opaque colors.

提交回复
热议问题