ChromaColorPicker icon indicating copy to clipboard operation
ChromaColorPicker copied to clipboard

How could I add event to the home handle?

Open davideuler opened this issue 3 years ago • 0 comments

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

`

davideuler avatar May 25 '21 01:05 davideuler