Skip to content

Configuring Double Tap Shortcut Buttons

adonitMark edited this page Sep 6, 2016 · 1 revision

To connect shortcut button double tap to actions within your application, the first thing you need to do is to create a JotShortcut object. In the example below, a shortcut called Undo is created which is associated with an undo method within your application.

JotShortcut *undoShortcut = [[JotShortcut alloc] initWithDescriptiveText:@"Undo" key:@"undo" 
           target:self selector:@selector(undo)];

To assign this undo shortcut to the physical button number 1, simply do the following:

[[JotStylusManager sharedInstance] setButton1DoubleTapShortcut:undoShortcut];

Similarly, if instead you wanted to assign it to physical button number 2:

[[JotStylusManager sharedInstance] setButton2DoubleTapShortcut:undoShortcut];

If you want to make the undo shortcut available for the user to assign it to a button later:

[[JotStylusManager sharedInstance] addScrollShortcutOption:undoShortcut];

Any shortcut added using this method can be retrieved later by using the shortcuts property on the JotStylusManager. If you want to add a shortcut to this list and assign it to a particular button at the same time, you can alternatively call either of the following methods depending on what button you want to assign a shortcut to:

[[JotStylusManager sharedInstance] addShortcutOptionButton1DoubleTapDefault:undoShortcut];
[[JotStylusManager sharedInstance] addShortcutOptionButton2DoubleTapDefault:undoShortcut];

Also consider using the Shortcut Button View Controller which allows a user to connect an action with a physical shortcut button.