Pointer Down Event

I have an imageview in a view and I want the user to be able to move it but I am not noticing an event to catch this.
Imageview only has Open and Close what should be the approach?

Part 2 I want to use a png image so I can use the transparency but I can’t seem to load it into the imageview, will an imageview only load jpegs from the project?

The only control that has PointerDown is iOSCanvas.

Place the ImageView on top of a Canvas and make sure it is child (the canvas has a red outline). Then the canvas will trigger PointerDown for you.

BTW I just filed a feature request to have all controls support PointerDown, PointerUp and PointerDrag, like Desktop has been supporting since the very early days or RS.

In the Pointerup event I put ImageView2.Top = pos.Y ImageView2.left = pos.X but it says I cannot assign a value to this property, so how to you allocate the new position?

(Jean-Paul it was a corrupt png)

Would it look like this

Dim left As New iOSLayoutConstraint(LeftConstraintImageview2, _
iOSLayoutConstraint.AttributeTypes.Left, _
iOSLayoutConstraint.RelationTypes.Equal, _
Self, iOSLayoutConstraint.AttributeTypes.Left, _
1.0, pos.X)

If you use iOSKit you can capture touch events using the various gesture recognizer classes.

Hi Jason, bit of a newbie question but

Declare sub addGestureRecognizer lib “UIKit” selector “addGestureRecognizer:” (ctrl as ptr, recognizer as ptr)
//recognizer1 is a UITapGestureRecognizer dragged onto the view
//imageView1 is an iOSImageView dragged onto the view
addGestureRecognizer(ImageView2.handle, recognizer1)

it comes up with recognizer1 does not exist

Where did you put that code? It should work like you have it. Is it possible the image view is the wrong name since you have a discrepancy between your comment and code?

Hi Jason, I put it in the Open event of Imageview2 also tried it in the Open event of the View

And no typo in recognizer? Make sure it auto completes. I’ve done that exact thing before so I know it works.

Hi Jason, I’m going around in circles. Is there an example with just that added to a view and collecting the tap position?

Have you simply tried the canvas solution ? It is far more simple to use.

This is a fairly old example which I made about a year ago but it still works. The modules from the example are all a part of iOSKit so you can ignore them if you copy the view into your project.


Until the scope of what you need changes and suddenly you need more advanced gesture recognition than is available in the canvas. Then you can write it yourself or use the declares classes.

Indeed. But given the OP difficulties of implementation, more complex may not be better. His original questions was simply PointerDown. Sometimes it is best to have something that works right away.

Thanks Michel, I will end up using both suggestions.

Thanks Jason the code was a handy example