我正在尝试将分段控件的背景更改为清除,但它不起作用。如果我将其更改为橙色或蓝色等明亮的颜色,颜色会发生变化,但清晰仍然会给我留下灰色阴影作为背景颜色?
struct HomeSwipeView: View {
init() {
UISegmentedControl.appearance().backgroundColor = .clear
UISegmentedControl.appearance().setTitleTextAttributes([
.font : UIFont.preferredFont(forTextStyle: .headline)
], for: .normal)
}
var body: some View {
Picker("", selection: $selectedTabIndex) {
Text("One").tag(0)
Text("Two").tag(1)
}.pickerStyle(SegmentedPickerStyle())
}
}