Skip to content

DetailButton sender, presenting a popover viewcontroller #92

@txaiwieser

Description

@txaiwieser

Hello! Thanks again for sharing this!
I'm trying to present a view controller with a Popover style when the user touches the DetailButton inside a cell.
The thing is i haven't found yet a solution to get the sourceRect or the accessoryView itself.

accessory: .DetailButton({ [unowned self] in
    let detailButton = // Thats what i need 
    let vc = UIViewController()
    vc.modalPresentationStyle = .Popover
    vc.preferredContentSize = CGSize(width: 100, height: 200)
    vc.popoverPresentationController?.sourceView = detailButton
    vc.popoverPresentationController?.sourceRect = detailButton.bounds
    vc.popoverPresentationController?.permittedArrowDirections = .Any
    vc.popoverPresentationController?.delegate = self
    self.presentViewController(vc, animated: true, completion: nil)
})

Anyone have a solution to this since we don't have any arguments in the Selection closure?

Thanks! 👍👍👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions