0

I find that .listRowBackground(Color.Red.Blush) can set the list row column, but in the List there are some empty row are still white. When I scroll on the List, it also show some white area. Can somebody help to slove this peoblem? It's also appreciated for telling me how to change the color with the SegmentedPickerStyle. This video shows my problem. https://youtu.be/aEPw5hHBkFE Thank you!

struct UserNotificationCellView: View {
@ObservedObject var userNotification: UserNotification
@ObservedObject var userNotifications: UserNotifications
    var body: some View {
       {
             ......          
        }
        .padding(.horizontal,20)
            .cornerRadius(14)
            .listRowBackground(Color.Red.Blush)
//          .background(Color.Red.Blush)
  }
}

Below is my List code

List {
            ForEach(userNotifications1.userNotificationsArray, id: \.notifyId) { (userNotification) in
                UserNotificationCellView(userNotification: userNotification,userNotifications: self.userNotifications1)
 //                        .listRowBackground(Color.Red.Blush)

            }.colorMultiply(Color.Red.Blush)
            Spacer()
        }.environment(\.defaultMinListRowHeight, 80)

1 Answer 1

1

I'd recommend adding a global style in your AppDelegate class. From here you can change class properties that are currently inaccessible by SwiftUI via appearance.

UITableView.appearance().backgroundColor = .clear
UISegmentedControl.appearance().....

From here you can change your list background color and any segmented control properties you need to.

For the empty cells you can try adding an empty footer

List {
    Section(footer: self.footer) {
        ForEach(userNotifications1.userNotificationsArray, id: \.notifyId) { (userNotification) in
                UserNotificationCellView(userNotification: userNotification,userNotifications: self.userNotifications1)
 //                        .listRowBackground(Color.Red.Blush)

            }.colorMultiply(Color.Red.Blush)
        }
    }.environment(\.defaultMinListRowHeight, 80)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.