SwiftUI List with NavigationLink how to make custom highlight on tap

后端 未结 2 835
不思量自难忘°
不思量自难忘° 2021-01-21 07:03

How I can make custom overlay over List row that will highlight it on tap. I am using NaviagationLink and I\'ve changed

UITable         


        
2条回答
  •  日久生厌
    2021-01-21 08:00

    I do it this way:

    List {
        ForEach(0..

    And ButtonStyle:

    struct ListButtonStyle: ButtonStyle {
    
        func makeBody(configuration: Self.Configuration) -> some View {
    
            configuration.label
                .overlay(configuration.isPressed ? Color("Dim").opacity(0.4) : Color.clear)
        }
    }
    

提交回复
热议问题