UIPicker detect tap on currently selected row

First, conform the class to the UIGestureRecognizerDelegate protocol Then, in the view setup: UITapGestureRecognizer *tapToSelect = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tappedToSelectRow:)]; tapToSelect.delegate = self; [self.pickerView addGestureRecognizer:tapToSelect]; And elsewhere: #pragma mark – Actions – (IBAction)tappedToSelectRow:(UITapGestureRecognizer *)tapRecognizer { if (tapRecognizer.state == UIGestureRecognizerStateEnded) { CGFloat rowHeight = [self.pickerView rowSizeForComponent:0].height; CGRect selectedRowFrame = CGRectInset(self.pickerView.bounds, 0.0, (CGRectGetHeight(self.pickerView.frame) – rowHeight) / 2.0 ); … Read more

Is it possible to add an eventlistener on a DIV?

Yeah, that’s how you do it. document.getElementById(“div”).addEventListener(“touchstart”, touchHandler, false); document.getElementById(“div”).addEventListener(“touchmove”, touchHandler, false); document.getElementById(“div”).addEventListener(“touchend”, touchHandler, false); function touchHandler(e) { if (e.type == “touchstart”) { alert(“You touched the screen!”); } else if (e.type == “touchmove”) { alert(“You moved your finger!”); } else if (e.type == “touchend” || e.type == “touchcancel”) { alert(“You removed your finger from the … Read more

In Android, what is the difference between getAction() and getActionMasked() in MotionEvent?

getAction() returns a pointer id and an event (i.e., up, down, move) information. getActionMasked() returns just an event (i.e., up, down, move) information. Other info is masked out. For example: getAction() returns 0x0105. getActionMasked() will return 0x0005, which is 0x0105 && ACTION_MASK. The value of ACTION_MASK is 0xFF. It masks the following actions. ACTION_DOWN 0, … Read more

How can I implement a touch-sensitive, responsive, sortable list supporting drag & drop for Bootstrap?

The answers posted before this one are surprisingly outdated. rubaxa-sortable is a fast, no-dependencies, small reorderable lists widget with touch support that works with the HTML5 native drag&drop API. You can use it with Bootstrap, Foundation, or any CSS library you want, and instantiating it only takes one line. It supports reordering within a list … Read more

event.originalEvent jQuery

event.originalEvent is usually just the native event (also described here). However, if the browser is compatible, and the event was a touch event then that API will be exposed through event.originalEvent. The short answer is that event.originalEvent is not always the same, it depends on which event type triggered the handler, and on the environment … Read more

Is there a way to touch-enable scrolling in a WPF ScrollViewer?

You should use the attached properties: ScrollViewer.PanningMode ScrollViewer.PanningDeceleration ScrollViewer.PanningRatio The PanningMode defaults to None in the ScrollViewer default style, but setting it to another value will enable touch scrolling. I’m currently investigating using this feature in my app and am looking for a good deceleration and ratio value… I’ll probably just have to test them … Read more

How to cancel an Dialog themed like Activity when touched outside the window?

Just to point out that there is a way to get dialog-like “touch outside to cancel” behaviour from an Activity themed as a dialog, though I’ve not fully investigated whether it has unwanted side effects. Within your Activity’s onCreate() method, before creating the view, you’re going to set two flags on the window: One to … Read more