ra1028 / PathDynamicModal

A modal view using UIDynamicAnimator, like the Path for iOS.
MIT License
286 stars 33 forks source link

Custom Buttons inside the modal view do not receive tap events #4

Closed funkenstrahlen closed 8 years ago

funkenstrahlen commented 8 years ago

I have several custom buttons inside the view I present with your class. However they do not receive any touch / tap events any more as I assume your class is fetching them.

How can I fix that?

funkenstrahlen commented 8 years ago

I tested in your demo app. It works there.

Could the problem be that I use a ViewController instead of a view?

    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)

        // configure event detail view controller as popup content
        let favoriteDetailVC = storyboard.instantiateViewControllerWithIdentifier("FavoriteDetail") as! FavoriteDetailViewController
        let cell = tableView.cellForRowAtIndexPath(indexPath) as! AddFavoriteTableViewCell
        favoriteDetailVC.podcast = cell.podcast

        let view = favoriteDetailVC.view
        // scale the popover
        let screenSize: CGRect = UIScreen.mainScreen().bounds
        view.layer.cornerRadius = 5.0
        view.bounds = CGRectMake(0, 0, screenSize.width * 0.9, 400)

        let window = UIApplication.sharedApplication().delegate?.window!
        let modal = PathDynamicModal.show(modalView: view, inView: window!)

        tableView.cellForRowAtIndexPath(indexPath)?.selected = false
    }

The ViewController might be cleared from memory when I only pass the view to PathDynamicModal?

funkenstrahlen commented 8 years ago

That's actually the case. As soon as I put the view controller as a variable in your class, the buttons work again.