如何在UIPickerView中更改背景颜色? [英] how to change the background color in UIPickerView?

查看:409
本文介绍了如何在UIPickerView中更改背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改 UIPickerView 中的背景颜色,是否可以?

I want to change the background color in UIPickerView, Is it possible?

推荐答案

更新:一个简单的技巧是在某些子视图上设置alpha。哪一个具体取决于你有多少组件,但代码是:

UPDATE: One simple trick is to set the alpha on some of the subviews. Which one specifically depends on how many components you have, but the code is:

[(UIView*)[[picker subviews] objectAtIndex:2] setAlpha:0.5f];

这将使表盘半透明并透过背景颜色显示。

This will make the dial semi transparent and show through the background colour.

设置backgroudColor似乎没有做任何事情。到目前为止我能做的最好的是设置单个组件行的背景颜色,这是无用的,因为组件的基色将保持白色。

Setting the backgroudColor doesn't appear to do anything. The best I have been able to do so far is set the background colour of individual component rows, which is next to useless as the base colour of the component will remain white.

理想情况下,我想设置每个组件的背景颜色(即拨号)。

Ideally I'd like to set the background colour of an each component (i.e. dial).

这篇关于如何在UIPickerView中更改背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆