0

I have a bunch of TabViews in my view structure all with .tabViewStyle(.page) to get paged tab views with the little dots to cycle through some pictures. I want the dots to have a background so they can be seen regardless of the picture contents.

I tried lots of things (labels, tints, foreground colors, background colors, etc.) but nothing worked. I eventually guessed my way into

TabView {
    // My Image views
}
.tabViewStyle(.page)
.onAppear {
    UIPageControl.appearance().backgroundStyle = .prominent
}

Which does exactly what I want! Until I swipe to the next picture and then the background disappears...

How do I get the backgroundStyle on the TabView to stay?

ima747
  • 4,667
  • 3
  • 36
  • 46

1 Answers1

2

You can set the indexViewStyle to always show

TabView {
    // My Image views
}
.tabViewStyle(.page)
..indexViewStyle(.page(backgroundDisplayMode: .always)) <-- HERE
sfung3
  • 2,227
  • 1
  • 9
  • 30
  • That was it, thanks! How might I find that via the documentation? I don't see how to navigate from TabView to .indexViewStyle (i.e. I don't see how they're connected concepts if I don't already know those terms are specifically connected) – ima747 Aug 23 '22 at 11:32