- Home
- Forum
- Xamarin.iOS
- 3D Touch to Trigger Trackball
3D Touch to Trigger Trackball
Is 3D touch or Force Touch used for the trackball to get triggered on capable iOS devices by default? If so, how does one change it to be triggered by normal touch? If not, what is used to enable this feature?
SIGN IN To post a reply.
4 Replies
LA
Lavanya Anaimuthu
Syncfusion Team
June 28, 2018 11:58 AM UTC
Hi Peter Cardenas,
Thanks for using Syncfusion Support.
We have achieved this requirement by extending the ChartTrackballBehavior TouchesMoved(NSSet touches, UIEvent uiEvent).
Please refer the code snippet.
Code snippet [C#]:
|
public override void TouchesMoved(NSSet touches, UIEvent uiEvent)
{
base.TouchesMoved(touches, uiEvent);
UITouch touch = touches.AnyObject as UITouch;
if(touch != null)
{
var force = touch.Force;
var maxForce = touch.MaximumPossibleForce;
if(force >= touch.MaximumPossibleForce/2)
{
CoreGraphics.CGPoint point = touch.LocationInView(touch.View);
this.Show(point);
}
}
} |
We have prepared a sample based on your requirement. Please download the sample from the following location.
Please let us know, if you need further assistance on this.
Regards,
Lavanya Anaimuthu.
PC
Peter Cardenas
June 29, 2018 09:39 AM UTC
I greatly thank you for your aid. How can I hide the trackball if the user is not touching the screen? Would the following work if I wanted to make the trackball show when touching the screen, and not show when the user is not touching the screen?
if (touch != null)
{
var force = touch.Force;
var maxForce = touch.MaximumPossibleForce;
if (force <= maxForce / 2)
{
CoreGraphics.CGPoint point = touch.LocationInView(touch.View);
this.Show(point);
}
}
else
{
this.Hide();
}
{
var force = touch.Force;
var maxForce = touch.MaximumPossibleForce;
if (force <= maxForce / 2)
{
CoreGraphics.CGPoint point = touch.LocationInView(touch.View);
this.Show(point);
}
}
else
{
this.Hide();
}
PC
Peter Cardenas
June 29, 2018 10:10 AM UTC
I have figured it out, sorry for the inconvenience.
MP
Michael Prabhu M
Syncfusion Team
July 2, 2018 06:02 AM UTC
Hi Peter,
We are glad that you have found the solution, please let us know if you need any further assistance on this.
Thanks,
Michael
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
PC Peter Cardenas
- Jun 27, 2018 12:33 AM UTC
- Jul 2, 2018 06:02 AM UTC