I have been researching everywhere and can't find if there is a unique identifier for each touch point in ios. I also would like to know how to access that in swift but can't find any documentation on it.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- SwiftUI: UIImage (QRCode) does not load after call
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Using if let syntax in switch statement
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Enum with associated value conforming to CaseItera
- Swift - hide pickerView after value selected
- Is there a Github markdown language identifier for
Not really for each point, but for each touch. To access them requires your own touch handling, for example in the UIView where the touches occur or its ViewController. This simply requires you to write your own methods for
touchesBegan:withEvent:
,touchesMoved:withEvent:
andtouchesEnded:withEvent:
.When
touchesBegan:withEvent:
,touchesMoved:withEvent:
andtouchesEnded:withEvent:
are called by iOS, they report the touches in anNSSet
. Each member of that set is a unique pointer to the touch data structure, and you should use them as the keys in anNSMutableDictionary
if you want to filter touches over time.Like that in
touchesBegan
, when you encounter a touch for the first time:Now in
touchesMoved
you need to check the pointer against the stored keys:If there is already an entry which uses the same touchID as its key, you get the stored object for the key back. If no previous touch used that ID, the dictionary will return nil when you ask it for the corresponding object.
Now you can assign your own pointers to those touch points, knowing that they all belong to the same touch event.