jamshed jamshed - 4 months ago 25x
Objective-C Question

iOS 9.2 UIDatePicker corner and border not working

I am working with UIDatePicker where i need to set borderWidth, borderColor and cornerRadius. But i can't make it work. I have masksToBounds to YES also.

dateBtn.layer.borderWidth = 2.0;
dateBtn.layer.borderColor = [[UIColor redColor]CGColor];
dateBtn.layer.cornerRadius =5.0;

Any solution please ?


Works great for me:

self.datePicker.layer.borderColor   = [UIColor grayColor].CGColor;
self.datePicker.layer.borderWidth   = 1.0f;
self.datePicker.layer.cornerRadius  = 5.0f;
self.datePicker.layer.masksToBounds = YES;

Try my code in given order of it lines. Date picker with color rounded border