Avoid UIDatePicker transparency in iOS7

老子叫甜甜 提交于 2019-12-03 12:21:27

问题


i just upgraded my app to iOS7 and found that date picker is transparent. It looks like I can see everything which is behind the date picker. How can I avoid this?

I tried to place date picker in another view. But still, its transparent. How can I avoid transparency of UIDatePicker? I've tried this link 1: can I change the font color of the datePicker in iOS7? but it didn't work. Thanks in advance.

Edit : I've added a UIDatePicker to a view named whiteborderview.

whiteborderview.backgroundColor = [UIColor whiteColor];

whiteborderview.alpha = 1.0;

[whiteborderview addSubview:dtPkrStart] 

and I got output like this

but still its transparent.

Edit2

I used this code and now its looking better than previous one

[UIView appearanceWhenContainedIn:[UITableView class], [UIDatePicker class], nil].backgroundColor = [UIColor colorWithWhite:1 alpha:1];

dtPkrStart.backgroundColor = [UIColor blackColor];

The date picker appearence changed like this


回答1:


Just change background color of your date picker

datepicker.backgroundColor = [UIColor yourcolor];



回答2:


you can add a uiview with any color behind the uidatepicker. it will work for you.




回答3:


[UIView appearanceWhenContainedIn:[UITableView class], [UIDatePicker class], nil].backgroundColor =[UIColor colorWithWhite:1 alpha:0];
pickerView.backgroundColor=[UIColor whiteColor];
anotherView.backgroundColor=[UIColor whiteColor];//Another view on which you subview picker


来源:https://stackoverflow.com/questions/19264325/avoid-uidatepicker-transparency-in-ios7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!