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
3
votes
0 answers

Using arrow keys to navigate a UITableView

I would like to be able to traverse a UITableView using a physical keyboard's arrow keys then use the enter key to select a row. Normally the user would type into a UISearchBar then select a result without taking their hands off the keyboard. Is…
Davis Mariotti
  • 574
  • 1
  • 4
  • 23
3
votes
1 answer

iOS Navigate TableView with Arrow Keys

How can a UITableView be navigated with arrow keys (physical keyboard) much like the spotlight behavior that was introduced in iOS 10? Looking to have a user type into a search box and use the up/down arrow to highlight a row in a tableview and…
Michael Voccola
  • 1,827
  • 6
  • 20
  • 46
3
votes
1 answer

Listening for hardware keyboard key presses in Swift

I'd like to add hardware keyboard support to my app so users may trigger a function to be called by pressing a certain key on the keyboard at any time. I found this article and was able to make it work great in Objective-C. I've converted it to…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
2
votes
1 answer

SwiftUI iOS - how to use captured hardware key events

How can I use the pressed key information in my SwiftUI? I try to use @EnvironmentObject to share key with my SwiftUI but i get every time crash in sendKeybKey: Thread 1: Fatal error: No ObservableObject of type UserData found. A…
2
votes
1 answer

UIKeyCommand for the Enter key on Mac keyboard's numeric keypad

I'm using the Xcode 11 beta and using Catalyst ("the checkbox") to run an iPad app on the Mac. I've been able to use the following UIKeyCommands for input from the Mac keyboard: //the delete button UIKeyCommand(input: "\u{8}", modifierFlags: [],…
RanLearns
  • 4,086
  • 5
  • 44
  • 81
2
votes
1 answer

Different UIKeyCommand arrays for different view controllers in Swift

I have a problem with UIKeyCommand in Swift. I have two UIViewVontroller, ProjectsViewController and ViewController. I'm opening ViewController from ProjectsViewController using this code: let editor =…
2
votes
1 answer

command key in iOS simulator

The iOS simulator shortcuts frequently use the command key. I notice that when running in the simulator, attempts in my program to catch command-z, command-y, etc. don't work. I assume the reason is that the system interprets them as simulator…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
1
vote
1 answer

Detect shift + return key when UITextView is the responder

I want to detect if the user presses either just "return" key or "shift+return" key on the external keyboard to perform two different actions when the UITextView is the responder. It works when UITextView is not responding by using…
1
vote
0 answers

Swift set textview font programmatically only for new text typed not all text

I'm using UIKeyCommands to allow users with a bluetooth keyboard to use CMD + B for bold and CMD + I for italic. I've managed to do this successfully here ... @objc func boldText() { textViewOutlet.font = UIFont(name:"Avenir-Heavy", size:…
nc14
  • 539
  • 1
  • 8
  • 26
1
vote
0 answers

React Native: add keyboard shortcuts to iOS app

So I was trying add keyboard shortcuts to my React Native iOS app. So that users can with an external keyboard on the iPad can take advantage of those shortcuts. I've created an AppDelegate.swift and RootViewController.swift to work only with swift…
cronenberg
  • 97
  • 1
  • 9
1
vote
0 answers

ctrl + enter seems not working with UIKeyCommand

I am trying to interfere with the external hardware keyboard's inputs on an iOS system. Everything works well except for one problem: After attempt to register CTRL + ENTER with code UIKeyCommand(input: "\r", modifierFlags: [.control],…
Terry
  • 337
  • 2
  • 9
1
vote
1 answer

how to intercept key event of swift iOS app?

I deleted the @UIApplicationMain in AppDelegate.swiftand wrote the main.swift as below , but the program still can not fire keyPressed function. But executes print("send event2") every keydown. How to fire keyPressed function? Is something wrong…
1
vote
1 answer

UISplitviewController and different UIKeyCommands depending on master, detail or both being on screen

I want to include some UIKeyCommands in my app. My app consists of one UISplitViewController that forces the master to be always visible on iPad full screen. On smaller screen it works like it normally would. Now, I've implemented some…
user4992124
  • 1,574
  • 1
  • 17
  • 35
1
vote
0 answers

UIAlertController hides almost all UIKeyCommands

When a UIAlertController is presented, all UIKeyCommands from the responder chain are hidden besides the UITabBarController. The only key commands that work are: Escape, to dismiss the alert, and Return, to select the preferred action. I want other…
0
votes
1 answer

How to determine the source of unwanted iPadOS external keyboard shortcuts in a multiple window app?

At the time of writing, I’m developing with Xcode 14.2 and iPadOS 16.3.1. I am updating an existing app to support multiple windows/scenes for iPadOS. The main scene uses UIKit and the child scenes use mainly SwiftUI. I turned my attention to…
Kpalser
  • 843
  • 7
  • 8