2024年3月10日发(作者:)
MAC触控板震动反馈
let performer = let performer = NSHapticFeedbackManagerNSHapticFeedbackManager..defaultPerformer
m(.(.genericgeneric, , performanceTimeperformanceTime: .: .nownow))
NSHapticFeedbackPatterns
NSHapticFeedbackPatternsIs used to specify the type of tactile feedback, it takes one of the following
values.
.LevelChange
.Alignment
.Generic
.LevelChangeIt is, if the user has changed the strength to press the track pad, used to feedback it. For
example, if there is a button to accept the strength of the two-step, you will need to feed it back to the user
when the user switches to the second stage from the first stage, but you specify this in such instances.
.AlignmentIt is used to perform the guide when the user or to resize or move the object. For example, you
can get a tactile feedback, such as stick to grid when performing an operation of the control when the xib
editor Xcode operating in Force Touch trackpad, similar to that of the implementation in the application as
If you are to specify this.
.GenericIt is specified in case that does not apply to the above example.
NSHapticFeedbackPerformanceTime
NSHapticFeedbackPerformanceTimeSpecifies the timing at which the tactile feedback. .NowMake the
feedback at the same time as the specified call and the but, .DrawCompletedfor leaving be delayed if you
specify so far drawing complete, you can use both depending on the characteristics of the view.
Example
import Cocoa
let performer = tPerformer()
for _ in 0..<10 {
mFeedbackPattern(.Alignment, performanceTime: .Now)
sleep(1)
mFeedbackPattern(.LevelChange, performanceTime: .Now)
sleep(1)
mFeedbackPattern(.Generic, performanceTime: .Now)
sleep(1)
}
发布评论