Skip to content

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

Description

@davideuler

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)
    }

`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions