ilight ilight - 3 months ago 48
iOS Question

Change UITextField borderColor in Xamarin

I need to change a UITextField's borderColor to White in Xamarin.

I tried setting it's

layer.borderColor
and also runtime attributes in XCode IB but it was of no use.

Could someone please help me in achieving this?

Answer

This should get you there:

var textField = new UITextField();

textField.Layer.BorderColor = UIColor.White.CGColor;
textField.Layer.BorderWidth = 1f;

If that does not work, please show more code. Because then I presume your overwriting the style somewhere.