Note that there are some explanatory texts on larger screens.

plurals
  1. POSupport command, control and arrow keys when an external keyboard is attached
    primarykey
    data
    text
    <p>I have an iOS app where all I want to do is provide more support for basic command key combinations such as command+a, command+s, command+x, command+v and friends when a user has connected a bluetooth keyboard.</p> <p>I know this is possible. Applications such as Textastic and many other editing apps support these features.</p> <p>I have looked at UIResponder (which appears to only be used by the pop-up menu), UIKeyInput, UITextInput[Delegate] and other API docs with no reference to how to do this.</p> <p>It is easy to support which options are displayed in the UIMenuController using (BOOL)canPerformAction:(SEL)action withSender:(id)sender. However, this method does not appear to be called when a bluetooth keyboard is attached. So I either need to implement another method specifically for the keyboard or something else.</p> <p>I now suspect it could be that the text subsystem is responsible for performing the actions. However, there's no documentation that I can find! Also, none of the UITextInput delegate methods are called when an operation is performed. I'm almost thinking the solution is private and that I need to ask Apple specifically on how to get access to these features (which I have just done).</p> <p><strong>UPDATE:</strong></p> <p>positionFromPosition:inDirection:offset: is the method to use to detect when the arrow key is pressed. After iOS has called this method it then calls setSelectedText:. You'll need to work out the rest of the plumbing.</p> <p><strong>UPDATE 2:</strong></p> <p>I was able to answer all of the questions I had. Please refer to the marked solution for the answers.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload