[問題] UISegmentedControl 透明背景

看板MacDev作者 (-.-)時間11年前 (2013/04/30 10:52), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
大家好,請問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)

04/30 11:51, , 1F
可以。設背景圖片,不過小心iOS5/6可能會有不同結果
04/30 11:51, 1F

05/03 16:46, , 2F
謝謝^^
05/03 16:46, 2F
文章代碼(AID): #1HVp7orK (MacDev)