LoginSignup
1
1

More than 3 years have passed since last update.

NavigationLinkのLabelで指定したImageが青く表示される問題対応

Last updated at Posted at 2019-08-08

この記事について

NavigationLinkのLabelにImageを指定した場合青く表示されてしまう問題の解決方法です。
そうなるのかの深堀はまだしておりません:pray:
解決したよーって内容だけ先に記載します!

struct FreeView: View {
    var body: some View {
        NavigationView {
            ScrollView(.vertical) {
                NavigationLink(destination: ProfileView())  {
                    Image("icon")
                }
            }
        }
    }
}

スクリーンショット 2019-08-08 13.06.32.png

renderingModeをoriginalにする

struct FreeView: View {
    var body: some View {
        NavigationView {
            ScrollView(.vertical) {
                NavigationLink(destination: ProfileView())  {
                    Image("icon")
                        .renderingMode(.original)
                }
            }
        }
    }
}

# buttonStyleをplainにする

```swift
struct FreeView: View {
    var body: some View {
        NavigationView {
            ScrollView(.vertical) {
                NavigationLink(destination: ProfileView())  {
                    Image("icon")
                }
                .buttonStyle(PlainButtonStyle())
            }
        }
    }
}

スクリーンショット 2019-08-08 13.10.55.png

参考にしたサイト

Apple Developer Forums

1
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
1
1