Skip to main content

Posts

Showing posts with the label uitouch

How to detect particular UIImageView for UITouch Events

I've added 5 UIImageView dynamically and filled it with different images, what I am trying to do is "Allow user to set position for any UIImageView", for that I used -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //Here I want the object of particular UIImageView on which user touched. } NSLog(@"%@",[touches anyObject]); //It returns output like below, /*<UITouch: 0x68b95e0> phase: Began tap count: 1 window: <UIWindow: 0x68875d0; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x68b6470>> view: <UIImageView: 0x6a74cf0; frame = (83.7763 83.7763; 182.447 182.447); transform = [0.968912, -0.247404, 0.247404, 0.968912, 0, 0]; alpha = 0.8; opaque = NO; tag = 3; layer = <CALayer: 0x6a74980>> location in window: {161, 230} previous location in window: {161, 230} location in view: {52.7761, 105.448} previous location in view: {52.7761, 105.448}*/ //Note, in above output, it showing my UIImageView object on which I touc

How to detect particular UIImageView for UITouch Events

I've added 5 UIImageView dynamically and filled it with different images, what I am trying to do is "Allow user to set position for any UIImageView", for that I used -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //Here I want the object of particular UIImageView on which user touched. } NSLog(@"%@",[touches anyObject]); //It returns output like below, /*<UITouch: 0x68b95e0> phase: Began tap count: 1 window: <UIWindow: 0x68875d0; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x68b6470>> view: <UIImageView: 0x6a74cf0; frame = (83.7763 83.7763; 182.447 182.447); transform = [0.968912, -0.247404, 0.247404, 0.968912, 0, 0]; alpha = 0.8; opaque = NO; tag = 3; layer = <CALayer: 0x6a74980>> location in window: {161, 230} previous location in window: {161, 230} location in view: {52.7761, 105.448} previous location in view: {52.7761, 105.448}*/ //Note, in above output, it showing my UIImageView object on which I touc