SwiftUI表单选择器选择的背景色

时间:2020-08-15 07:37:47

标签: swiftui

在“表单选择器”中选择一个值后如何摆脱背景色?

之前:

enter image description here

之后:

enter image description here

Form() {
                    
    Picker(selection: self.$MonthIndex, label: Text("Month") ) {
                        
         ForEach(0 ..< self.months.count ) {
             Text("\(self.months[$0])").tag($0)
         }
                        
   } 

我对init()文件做了一些调整。 “选定”单元格有一个吗?

init(){
    
    UITableView.appearance().backgroundColor = .white
    UITableView.appearance().tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: Double.leastNonzeroMagnitude))
    UITableView.appearance().tintColor = .green
    
    UITableViewCell.appearance().backgroundColor = .white
    UITableViewCell.appearance().tintColor = .green
   
}

谢谢。

0 个答案:

没有答案