UIImageView Touch Event

you can use UITapGestureRecognizer added to the UIImageView via addGestureRecognizer snippets: UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(bannerTapped:)]; singleTap.numberOfTapsRequired = 1; singleTap.numberOfTouchesRequired = 1; [iv addGestureRecognizer:singleTap]; [iv setUserInteractionEnabled:YES]; and – (void)bannerTapped:(UIGestureRecognizer *)gestureRecognizer { NSLog(@”%@”, [gestureRecognizer view]); }

How to optimize website for touch devices

It sounds to me like you want to have a touch-screen-friendly option, to cover the following scenarios: iPhone-like devices: small screen, touch only Small screens, no touch (you didn’t mention this one) Large screens, no touch (i.e. conventional computers) Touch-screen-enabled large screens such as iPad, notebooks/pcs with touch screens. For case 1 and 2 you … Read more

Is there an equivalent to e.PageX position for ‘touchstart’ event as there is for click event?

Kinda late, but you need to access the original event, not the jQuery massaged one. Also, since these are multi-touch events, other changes need to be made: $(‘#box’).live(‘touchstart’, function(e) { var xPos = e.originalEvent.touches[0].pageX; }); If you want other fingers, you can find them in other indices of the touches list. UPDATE FOR NEWER JQUERY: … Read more

Handle touches not started on the UI

I seek a way to handle touches that do not start on UI elements in Unity Engine …But if the touch down event is on any of the UI elements it shall be handled by that UI element instead of the map. The IsPointerOverGameObject function is used to simplify this. If it returns false, do … Read more

Disable WebView touch events in Android

mWebView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); Disables all touch events on a WebView because the touch listener is executed before the default touch behavior of the WebView. By returning true the event is consumed and isn’t propagated to the WebView. Using android:clickable=”false” does not disable touch … Read more

Determine vertical direction of a touchmove

I had some issues in Ipad and solved it with two events var ts; $(document).bind(‘touchstart’, function (e){ ts = e.originalEvent.touches[0].clientY; }); $(document).bind(‘touchend’, function (e){ var te = e.originalEvent.changedTouches[0].clientY; if(ts > te+5){ slide_down(); }else if(ts < te-5){ slide_up(); } });

Click event called twice on touchend in iPad

iPad both understands touchstart/-end and mousestart/-end. Is gets fired like this: ┌─────────────────────┬──────────────────────┬─────────────────────────┐ │Finger enters tablet │ Finger leaves tablet │ Small delay after leave │ ├─────────────────────┼──────────────────────┼─────────────────────────┤ │touchstart │ touchend │ mousedown │ │ │ │ mouseup │ └─────────────────────┴──────────────────────┴─────────────────────────┘ You have to detect if the user is on a tablet and then relay on the touch … Read more

Eliminate 300ms delay on click events in mobile Safari

Now some mobile browsers eliminate 300 ms click delay if you set the viewport. You don’t need to use workarounds anymore. <meta name=”viewport” content=”width=device-width, user-scalable=no”> This is currently supported Chrome for Android, Firefox for Android and Safari for iOS However on iOS Safari, double-tap is a scroll gesture on unzoomable pages. For that reason they … Read more