作者s8911124 (-.-)
看板MacDev
标题[问题] UISegmented 透明背景
时间Tue Apr 30 10:52:30 2013
大家好,请问UISegmentedControl 有办法设置透明背景吗?
附上Sample Code...
if(self.flashSegmentedView==nil)
{
NSArray *itemArray =[NSArray arrayWithObjects:NSLocalizedString(MLS_Auto,nil)
,NSLocalizedString(MLS_Open,nil)
,NSLocalizedString(MLS_Close,nil), nil];
flashSegmentedView_ = [[UISegmentedControl alloc] initWithItems:itemArray];
self.flashSegmentedView.backgroundColor = [UIColor clearColor];
self.flashSegmentedView.segmentedControlStyle = UISegmentedControlStyleBar;
[self.flashSegmentedView setTintColor:[UIColor clearColor]
forTag:ButtonID_Auto];
...
[self.flashSegmentedView setTextColor:[UIColor whiteColor]
forTag:ButtonID_Auto];
...
[self.flashSegmentedView setShadowColor:[UIColor clearColor];
...
}
出来是灰黑色背景..白字
具体的做法我是参考:
http://www.framewreck.net/2010/07/custom-tintcolor-for-each-segment-of.html
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.163.14.75
※ 编辑: s8911124 来自: 118.163.14.75 (04/30 10:53)
1F:推 appleway:可以。设背景图片,不过小心iOS5/6可能会有不同结果 04/30 11:51
2F:→ s8911124:谢谢^^ 05/03 16:46