Change UIPickerView background

前端 未结 9 1075
天涯浪人
天涯浪人 2020-11-27 15:38

I want to change the border color of a UIPickerView. I do not see a tint property for the UIPickerView. Is there any way this could be done? Or a workaround?

Thanks.

9条回答
  •  佛祖请我去吃肉
    2020-11-27 16:41

    You could also mask the component. With a bit fiddeling you can get the size of the component and cut it out with following code:

    CALayer* mask = [[CALayer alloc] init];
            [mask setBackgroundColor: [UIColor blackColor].CGColor];
            [mask setFrame:  CGRectMake(10.0f, 10.0f, 260.0f, 196.0f)];
            [mask setCornerRadius: 5.0f];
            [picker.layer setMask: mask];
            [mask release];
    

    Don't forget

    #import 
    

提交回复
热议问题