有没有办法在swiftUI中更改tabView Indicator颜色?
这是我的代码
struct OnBoarding: View {
var body: some View {
TabView {
ForEach(0 ..< 3) { item in
VStack {
Image("discover")
.resizable()
.scaledToFit()
}
}
}
.tabViewStyle(PageIndexViewStyle(backgroundDisplayMode: Color ?))
}
}
struct OnBoarding_Previews: PreviewProvider {
static var previews: some View {
OnBoarding()
}
}
我尝试了tabViewStyle(PageIndexViewStyle(backgroundDisplayMode:Color?))但无法解决
最佳答案
您需要使用UIkit
init() {
UIPageControl.appearance().currentPageIndicatorTintColor = .red
UIPageControl.appearance().pageIndicatorTintColor = UIColor.black.withAlphaComponent(0.2)
}
关于swift - 更改TabView指示器SwiftUI,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62864221/