Questions tagged [uikeycommand]

The UIKeyCommand class specifies a key presses performed on a hardware keyboard and the resulting action that should take place.

41 questions
0
votes
1 answer

How to implement support for copy keyboard shortcut in UICollectionViewCell?

If you implement override func copy(_ sender: Any?) {} in a view controller, present that view controller, then hold down command the keyboard shortcuts overlay appears revealing Copy is an available action. But if you do that in a collection view…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
0
votes
0 answers

Cmd+B in UIKeyComands not displaying first typed "b" afetr using the command - swift

I'm using UIKeyCommands - Cmd+B to bold text. The code works fine to bold the text. But after i use the Cmd+B and when I type "b" the first time it doesn't display on my textView. Here's the code: override public var keyCommands: [UIKeyCommand]? { …
userNew
  • 11
  • 3
0
votes
0 answers

How do I write this in swift? Related to UIKeyCommand

How do I convert this into swift? This code takes the keyCommand: export function isBackspace(keyCode: number): boolean { return keyCode === 8; } export function isDeleteForward( keyCode: number, ctrlKey: boolean, …
akku
  • 25
  • 7
0
votes
1 answer

UIResponder: keyCommands not called; confirmed isFirstResponder

My app has a passcode view, conceptually similar to the iOS unlock screen. It's a UIViewController that I present within a new UIWindow. Works fine. I'm adding the capability to type the passcode using a hardware keyboard. The keyCommands method…
Mitch Cohen
  • 1,551
  • 3
  • 15
  • 29
0
votes
1 answer

Detect key press without modifier

I'd like to capture a keypress in my Catalyst app. UIKeyCommand(input: "", modifierFlags: nil, action: #selector(singleShift)) Unfortunately modifierFlags can't be nil and NSEvent isn't supported on Catalyst. Is there a way to detect single press…
user11145365
  • 184
  • 9
0
votes
2 answers

add variable to all UIViewControllers

I'm new to Swift and I'm trying to implement a custom UIKeyCommand architecture in a practice app. I wrote the extension below for the base UISplitViewController to show all UIKeyCommands in the current views on screen. extension…
user4992124
  • 1,574
  • 1
  • 17
  • 35
0
votes
2 answers

How to detect a Command C in my app (Swift)?

I have a calculator app written in Swift, and it's fully compatible with custom keyboard shortcuts. I'm trying call a method when the user presses Command + C, however, whenever I try to assign the following custom shortcut, it just doesn't…
ThiagoAM
  • 1,432
  • 13
  • 20
0
votes
2 answers

How to handle uppercase and lowercase characters when using UIKeyCommand

We are in the process of receiving and processing keyboard input. Among my source code, UIKeyCommand *menuKey = [UIKeyCommand keyCommandWithInput:[NSString stringWithFormat:@"%c", 77] modifierFlags:0 …
Nam
  • 163
  • 1
  • 1
  • 8
0
votes
1 answer

iOS Swift keyCommands Reading Numbers Only

Please consider the following code: override var keyCommands: [UIKeyCommand]? { var commands:[UIKeyCommand] = [] let numbers =…
Floyd Resler
  • 1,786
  • 3
  • 22
  • 41
0
votes
1 answer

UIKeyCommands not working

I'm trying to add custom shortcuts for iPad to my app. However, with the code below I can't get to see them working. When I press the command key I get the discovery modal, but when I then press command+f nothing happens. What am I doing…
user4992124
  • 1,574
  • 1
  • 17
  • 35
0
votes
1 answer

UIKeyCommands of custom UITableView not recognized

I have a UITableView subclass that has the keyCommands property implemented, where there are several UIKeyCommands provided. This UITableView is a subview of the main view in the View Controller. When I run the app and hold Command to preview the…
erdekhayser
  • 6,537
  • 2
  • 37
  • 69
1 2
3