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

Can not be selected when added inside UICollectionViewCell #5

Closed
johnyluyte opened this issue Feb 15, 2017 · 2 comments
Closed

Can not be selected when added inside UICollectionViewCell #5

johnyluyte opened this issue Feb 15, 2017 · 2 comments

Comments

@johnyluyte
Copy link

Hello,

When I added UIDropDown inside my UICollectionViewCell. It can not be selected. It doesn't response to user tap or click.

class MyCell: UICollectionViewCell {
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupViews()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    setupViews(){
        drop = UIDropDown(frame: CGRect(x: 0, y: 0, width: 80, height: 30))
        drop.center = CGPoint(x: 0, y: 0)
        drop.placeholder = "select your country"
        drop.options = ["Mexico", "USA", "England", "France", 
        drop.didSelect { (option, index) in
            print("You just select: \(option) at index: \(index)")
        }
        drop.tableHeight = 200
        drop.hideOptionsWhenSelect = true
        drop.animationType = UIDropDownAnimationType(rawValue: 0)!
        addSubview(drop)
    }
}

I've used UIDropDown in my other project. It works really great. Thanks you!
But I don't know what I'm doing wrong in this case.

@igongora
Copy link
Owner

Hi @johnyluyte , quick question. Are you using the "initWithFrame" to initialize your cell?. It looks that the method "setupViews" only gets called when you initialize from "initWithFrame"

@johnyluyte
Copy link
Author

@igongora Yes I did, the UIDropDown did show on the view, so I think the method "setupViews" is indeed being called. The problem is that even though UIDropDown did show on the view, but it didn't react to user taps.

I suppose this has something to do with UIGestureRecognizer. My project is quiet big and there might be some conflict between Gesture Event Listeners within objects. If UIDropDown did work on UICollectionViewCell for other people, than this issue can be closed. I'll look into my project. Thanks you!

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