Platforms to show: All Mac Windows Linux Cross-Platform
NSTouchMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa | MBS MacBase Plugin | 23.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
You access touch objects through UIEvent objects passed into responder objects for event handling. A touch object includes accessors for:
- The view or window in which the touch occurred
- The location of the touch within the view or window
- The approximate radius of the touch
- The force of the touch (on devices that support 3D Touch or Apple Pencil)
A touch object also contains a timestamp indicating when the touch occurred, an integer representing the number of times the user tapped the screen, and the phase of the touch in the form of a constant that describes whether the touch began, moved, or ended, or whether the system canceled the touch.
To learn how to work with swipes, read Handling Swipe and Drag Gestures in Event Handling Guide for UIKit Apps.
A touch object persists throughout a multi-touch sequence. You may store a reference to a touch while handling a multi-touch sequence, as long as you release that reference when the sequence ends. If you need to store information about a touch outside of a multi-touch sequence, copy that information from the touch.
Using NSTouch on macOS and UITouch on iOS.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.
- 15 properties
- property deviceSize as NSSizeMBS
- property force as Double
- property Handle as Integer
- property identity as MemoryBlock
- property majorRadius as Double
- property majorRadiusTolerance as Double
- property maximumPossibleForce as Double
- property normalizedPosition as NSPointMBS
- property phase as Integer
- property resting as Boolean
- property tapCount as Integer
- property timestamp as Double
- property type as Integer
- property view as NSViewMBS
- property window as NSWindowMBS
- 3 methods
- method Constructor Private
- method locationInView(View as NSViewMBS) as NSPointMBS
- method previousLocationInView(View as NSViewMBS) as NSPointMBS
- 5 constants
Touch Types
Constant | Value | Description |
---|---|---|
TouchTypeDirect | 0 |
A touch resulting from direct contact with the screen. |
TouchTypeIndirect | 1 | A touch that doesn’t result from contact with the screen. more |
TouchTypeIndirectPointer | 3 |
A touch resulting from a button-based, indirect input device that describes the input sequence from button press to button release. |
TouchTypePencil | 2 |
A touch from Apple Pencil. A pencil touch occurs when Apple Pencil interacts with the device’s screen. |
TouchTypeStylus | 2 |
A touch from a stylus. |
This class has no sub classes.
Blog Entries
- News from the MBS Xojo Plugins Version 24.1
- MonkeyBread Software Releases the MBS Xojo Plugins in version 24.1
- MBS Xojo Plugins, version 24.1pr4
- News from the MBS Xojo Plugins Version 23.5
- MonkeyBread Software Releases the MBS Xojo Plugins in version 23.5
- MBS Xojo Plugins, version 23.5pr7
Xojo Developer Magazine
Release notes
- Version 24.1
- Added identify, resting, deviceSize and normalizedPosition properties to NSTouchMBS class.
- Version 23.5
- Added NSTouchMBS class for macOS and iOS (using UITouch on iOS).
Some methods using this class:
- NSEventMBS.allTouches as NSTouchMBS()
- NSEventMBS.coalescedTouchesForTouch(touch as NSTouchMBS) as NSTouchMBS()
- NSEventMBS.predictedTouchesForTouch(touch as NSTouchMBS) as NSTouchMBS()
- NSEventMBS.touchesForView(view as NSViewMBS) as NSTouchMBS()
- NSEventMBS.touchesForWindow(win as NSWindowMBS) as NSTouchMBS()
- NSEventMBS.touchesMatchingPhase(Phase as Integer, view as NSViewMBS = nil) as NSTouchMBS()
Some events using this class:
- MapKitIOSControlMBS.touchesBegan(e as NSEventMBS, touches() as NSTouchMBS) as boolean
- MapKitIOSControlMBS.touchesCancelled(e as NSEventMBS, touches() as NSTouchMBS) as boolean
- MapKitIOSControlMBS.touchesEnded(e as NSEventMBS, touches() as NSTouchMBS) as boolean
- MapKitIOSControlMBS.touchesMoved(e as NSEventMBS, touches() as NSTouchMBS) as boolean
- SCNIOSControlMBS.touchesBegan(e as NSEventMBS, touches() as NSTouchMBS) as boolean
- SCNIOSControlMBS.touchesCancelled(e as NSEventMBS, touches() as NSTouchMBS) as boolean
- SCNIOSControlMBS.touchesEnded(e as NSEventMBS, touches() as NSTouchMBS) as boolean
- SCNIOSControlMBS.touchesMoved(e as NSEventMBS, touches() as NSTouchMBS) as boolean
Some related classes:
The items on this page are in the following plugins: MBS MacBase Plugin.
NSTouchBarMBS - NSTrackingSeparatorToolbarItemMBS
