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

DetailButton sender, presenting a popover viewcontroller #92

Open
txaiwieser opened this issue Sep 14, 2016 · 2 comments
Open

DetailButton sender, presenting a popover viewcontroller #92

txaiwieser opened this issue Sep 14, 2016 · 2 comments

Comments

@txaiwieser
Copy link
Contributor

txaiwieser commented Sep 14, 2016

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! 👍👍👍

@txaiwieser
Copy link
Contributor Author

Wondering if there is a way to access the Cell/Row from inside selected/accessory.
So instead of
public typealias Selection = () -> Void
It would be something like this:
/// Row or Accessory selection callback.
public typealias Selection = (cell: UITableViewCell) -> Void

@calebd
Copy link

calebd commented Jan 3, 2017

I would also like this. I have to map Rows to IndexPaths to solve this otherwise.

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

2 participants