admin管理员组

文章数量:1123011

I realize that with a SwiftUI popover you can set its attachment anchor but is there really no way to tell influence whether SwiftUI puts the popover box below what is presented?

Take this design here

When implemented in SwiftUI like this

    Button {
        showDetails = true
    } label: {
        HStack {
            Text(name)
            Image(systemName: "chevron.down")
        }
    }
    .font(.system(size: 16, weight: .bold))
    .popover(isPresented: $showDetails, attachmentAnchor: .point(.bottom)) {
        Details(id: id)
    }

I get this ugly behavior where the popover covers the object that displayed it even though there is plenty of space below the button to display the popover without overlap.

I am guessing SwiftUI has some "rules" about what it thinks is best for where the popover should go but is there really no way to influence them?

本文标签: Is there any way to tell SwiftUI to present popover content below the object displaying itStack Overflow