Reputation: 172
I am working on creating a color picker for "iOS". I am using this project, since it does what i want: "This"
I want to create a moveable circle (UIView
) on top of the palette (UIImageView
).
What I want to do is, while users move the circle, take the touch point and call the method getPixelColorAtLocation();
and change the background color of the circle to the color on current point. (Seen on most of the color palette/wheels)
The method getPixelColorAtLocation()
is available on a child view. I created a circle with UIView
on parent view, the problem is I cant call to getPixelColorAtLocation()
from parent view.
My question is, Is there anyway to add a UIView
as a subView
to UIImageView
. If I cant, what choices do I have to achieve what I want?
Upvotes: 1
Views: 632
Reputation: 992
An image view is just a subclass of UIView, so you can add subviews to it however you'd like. If there's a reason why you can't do so, then you can always make it a subview of the image view's superview, move it to the front, and then use convertPoint:toView:
to convert to the image view's coordinate system, then get the pixel color.
Upvotes: 0