I want to permit the person to decide on a colour on iOS.
I exploit the next code to fireside up the colour picker:
var picker = new UIColorPickerViewController(); picker.SupportsAlpha = true; picker.Delegate = this; picker.SelectedColor = colour.ToUIColor(); PresentViewController(picker, true, null);
When the colour picker shows, the colour is all the time barely off. For instance:
enter RGBA: (220, 235, 92, 255)
the preliminary colour within the colour picker could be:
chosen colour: (225, 234, 131, 255)
(these are actual values from checks). Not a great distance off… however sufficient to note in case you are searching for it.
I used to be questioning if the colour picker grid was forcing the colour to the
nearest colour entry – but when that had been true, you’d count on sure colours to
keep fastened (i.e. if the enter colour precisely matches one of many grid colours,
it ought to keep unchanged). That doesn’t occur.
p.s. I retailer colours in a cross platform trend utilizing easy RGBA values.
The ToUIColor converts to native UIColor utilizing
new UIColor((nfloat)rgb.r, (nfloat)rgb.g, (nfloat)rgb.b, (nfloat)rgb.a);