Skip to content

Want to fill colour in touch but fill on different place #6

@waseemSuave

Description

@waseemSuave

Hi

I am making app where user can able to fill colour. App is auto layout and image is on full screen and user can fill colour by tapping on image.

But when i use touchbegan method for getting user points and then passing these points in your method, result was fill colour on different place please check image
untitled

my touch began method is

override func touchesBegan(_ touches: Set, with event: UIEvent?) {
let touch = touches.first!
let location = touch.location(in: self.imgViewMain)
print(location.x)
print(location.y)

    self.imgViewMain.image =  self.imgViewMain.image?.pbk_imageByReplacingColorAt(Int(location.x), Int(location.y), withColor: .yellow, tolerance: 100, antialias: true)
}

Can you please sort out where i am doing this wrong

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