LoginSignup
0
1

More than 1 year has passed since last update.

SwiftUIのListの背景色が灰色にならないようにする

Posted at

SwiftUIのListの背景色が勝手に灰色になってしまって、ここ2日ほど困っていたのですがようやく解決できたのでメモしておきます。

Xcode 14.2
List {
    // do something here
}
.scrollContentBackground(.hidden) // <= 追加

このListはNavigationViewの下に入っていたのでNavigationViewを疑っていたのですが、違いました。NavigationViewを取り除いても灰色が消せなかったので、Listの方を疑いました。

SwiftUIでNavigationViewのタイトルやテーブルビューの背景を変える

他の解決策があるような気がして追加で調べると、記事も見つかりました(困っている間はこの記事に辿り着けなかった)。

【SwiftUI】Listの背景色を変更する | DevelopersIO

References

  1. scrollContentBackground(_:) | Apple Developer Documentation
  2. swift - iOS 16 SwiftUI List Background - Stack Overflow
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1