出于某种原因,iOS 8上的UIDatePicker在后台显示一个白色框。经过一番挖掘后,我找不到解决问题的答案(见附图)。
在其他描述iOS 7类似问题的帖子中,我尝试了UIAppearance
并循环浏览了所有UIDatePicker的子视图,并将背景更改为[UIColor clearColor]
。
不幸的是,这些还没有解决问题。
任何建议将不胜感激。谢谢你的时间。
答案 0 :(得分:0)
尝试使用" layer"。适用于iOS 7和iOS 8.但此解决方案不适用于UIAppearance。
#import <QuartzCore/QuartzCore.h>
.....
thePicker.layer.backgroundColor = [UIColor whiteColor].CGColor;
任何人都有更好的解决方案吗?
答案 1 :(得分:0)
我有同样的问题,在找到它之后我发现了这个:
[[UITableView appearanceWhenContainedIn:[UIDatePicker class], nil] setBackgroundColor:nil]; // for iOS 8
我是在ViewController的viewDidLoad中完成此操作的,其中设置了UIDatePicker。这对我有用。