看板 MacDev 關於我們 聯絡資訊
大家好,請問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)
appleway:可以。設背景圖片,不過小心iOS5/6可能會有不同結果 04/30 11:51
s8911124:謝謝^^ 05/03 16:46