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

How could I add event to the home handle? #61

Open
davideuler opened this issue May 25, 2021 · 0 comments
Open

How could I add event to the home handle? #61

davideuler opened this issue May 25, 2021 · 0 comments

Comments

@davideuler
Copy link

I created a customHandle, and a homeHandle,
and add snapkit constraints to the homeHandle, so that the home handle will be shown around the colorPicker, not inside the color picker. But the home handle could not respond to the touchUpInside of the ColorPicker. while the customHandle respond to the event. If I remove the snapkit constraints, it respond to the event too. How could I add event processing code to the Home Handle? I hope the color picker could be closed after user click the home handle.
`

    // Add handle with reference
    let customHandle = ChromaColorHandle()
    customHandle.color = UIColor.purple
    colorPicker.addHandle(customHandle)
    
    let homeHandle = colorPicker.addHandle(at: .purple)
    let customImageView = UIImageView(image: #imageLiteral(resourceName: "home").withRenderingMode(.alwaysTemplate))

    customImageView.contentMode = .scaleAspectFit
    //customImageView.tintColor = .white
    homeHandle.accessoryView = customImageView
    homeHandle.accessoryViewEdgeInsets = UIEdgeInsets(top: 35, left: 15, bottom: 30, right: 30)

    homeHandle.snp.makeConstraints{(make) ->  Void in
        make.left.equalTo(colorPicker.snp.left).offset(10)
        make.top.equalTo(colorPicker.snp.top).offset(20)
    }

`

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

1 participant