how to do something when the double touch on screen in android?
i have Use SensorEventListener ,
SensorManager.SENSOR_STATUS_*
or use MostionEvent?
Related
How can I reverse the zooming of the storyboard when I press option + mouse wheel?
I know how to change it on my laptop in settings but I don't see an option for Xcode.
Thank you
For zooming you can set double touch mouse in:
Click the Apple icon in left corner of your screen
Go to System Preferences>Mouse> set your zooming in More gestures tab
The question is very simple, how to enable scroll and zoom inside a UIScrollView in tvOS?
I tried the same initializer code from iOS and returned the scrollview for the focusedView var, but nothing happens when i touch the remote.
Also, i tried to add another custom UIPanGestureRecognizer to the scrollview and actually it works, but i don't want to handle the pan with custom code, just use the same pan behavior like iOS.
Let me know, thanks.
You can configure the scroll view's built-in pan gesture to recognize touches on the Siri Remote. It doesn't do that automatically, because normally scroll views on tvOS aren't scrolled directly by touches: they're scrolled automatically as focus moves between views within the scroll view.
If you really want the scroll view to move directly from touches, you'll need to add UITouchTypeIndirect to the allowedTouchTypes of the scroll view's panGestureRecognizer:
scrollView.panGestureRecognizer.allowedTouchTypes = #[ #(UITouchTypeIndirect) ];
You'll also need to make sure that either the scroll view itself is the focused view, or is a parent of the focused view, since all touches from the remote will start at the center of the focused view: you need to make sure the scroll view is getting hit-tested for the events to work.
Zooming won't work, because the Siri Remote can only recognize one touch at a time, so you can't do a pinch gesture on it.
Swift 4 version (from here: https://stackoverflow.com/a/41000183/945247)
scrollView.panGestureRecognizer.allowedTouchTypes = [NSNumber(value:UITouchType.indirect.rawValue)]
There's no code involved at the moment, only storyboard or xib files as far as the textview is concerned. This is what I get when running the app on my iPhone 5s or via the simulator.
I'm using auto layout and size classes with the option any width-any height. An imageview at the top, then a label, then the textview.
Here's a picture of the screen. As you can see, it looks as if the text is starting behind the label, but the textview's y is after the label and the constraints seem all correct according to Xcode 6. It works fine on iPad.
Any idea of what I'm doing wrong?
I've found a way round it: textview should have no scrolling enabled and should be put in a scrollview instead, which will do the actual scrolling. Need to add constraints to both.
now,i have a UIWebview inside a uiscrollview,i want to detect single tap on uiscrollview,but i have no idea to achieve it!it's so boring!
I would strongly suggest using the MGBox2 controls for your scrollview https://github.com/sobri909/MGBox2. They have an excellent wrapper for a scrollview which exposes tap events easily for the scrollview and the contents thereof.
You would place your UIWebview in an MGBox and add the MGBox to your MGScrollView.
It would then work like this:
myScrollView.onTap =^{[self doThisOnTap];};
Is there any touches began function in windows phone XNA?
Here I am using a Texture2D and I want to detect the tap on it.
How to do that in xna?
You need to use the TouchCollection class and set a TouchLocation for your Texture2D
Get it's state via:
TouchCollection touch = TouchPanel.GetState()
Then iterate over the TouchLocations in your collection, i guess this will be your texture2D's position:
foreach(TouchLocation tl in touch)
Then inside this loop you can check if the location was touched via the State property of tl e.g.
if(tl.State == TouchLocationState.Pressed)
{
//Execute your code here
}
We wrote our own button class and made certain sprites inherit from this button class. Pretty good way to go about it since the entire sprite then acts as a button.