Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem using a custom number picker as a .popover #96

Open
McWare opened this issue Aug 9, 2023 · 1 comment
Open

Problem using a custom number picker as a .popover #96

McWare opened this issue Aug 9, 2023 · 1 comment

Comments

@McWare
Copy link

McWare commented Aug 9, 2023

I put this view (a custom picker to select seconds) into the .popover in my SwiftUI project (Xcode 14.3.2):

struct CustomSecondsPickerView: View {

let fieldWidth = 75.0

@Binding var selectedSecond: Int
@Binding var isPresented: Bool

var body: some View {
    VStack {
        HStack {
            Picker("", selection: $selectedSecond) {
                ForEach(0..<60, id: \.self) { second in
                    Text("\(second)").font(.system(size: 18))
                }
            }
            .pickerStyle(WheelPickerStyle())
            .frame(width: fieldWidth) // Adjust width to fit the pickers better
        }
    }
    .frame(height: 100)
    .background(Color(UIColor(white: 0.98, alpha: 1.0))) // Set the background color
    
    .cornerRadius(12) // Add rounded corners with a radius of 8 pixels
}

}

It shows up perfectly, but I cannot really use the picker on it. It just scrolls the numbers every now and then when I seam to have touched a certain part of the picker view. What could be the problem?

@McWare
Copy link
Author

McWare commented Aug 10, 2023

fixed the problem by setting rubber banding attribute to .none!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant