0

How to programmatically scroll ScrollViewReader component inside UITableViewCell

enter image description here

Basically, I have 2 horizontal axis (rows) inside UITableViewCell. As shown in an attached gif file, I select the h3 option on the first axis, explicitly scroll, and move it out of bounds. On the 2nd when I selected option v4, the first row selected option also should be visible on the screen.

When the user selects open on the axis(row) it shows selected in center position by below lines of code.

.onChange(of: viewModel.selectedId) { _ in
      proxy.scrollTo(viewModel.selectedId, anchor: .center)      
}

I want to apply the same things to previously selected row. so I this case, auto-scroll to the selected option in the first row when the user performs q selection action in a second row.

Does anyone know how can I do it?

kb920
  • 3,039
  • 2
  • 33
  • 44

0 Answers0