[ad_1]
I would like to permit the consumer 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 may be:
chosen colour: (225, 234, 131, 255)
(these are actual values from assessments). Not a great distance off… however sufficient to note if you’re on the lookout for it.
I used to be questioning if the colour picker grid was forcing the colour to the
nearest colour entry – but when that have been true, you’ll count on sure colours to
keep mounted (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 style 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);
[ad_2]
