iOS 6: Turn off keyboard shortcuts - iphone

Is there is any way to turn off keyboard shortcuts in iOS 6 for particular textfield/textview?
I want to turn off keyboard shortcut for my app only and not from 'Settings app' of iOS.
I started writing my own text editor to achieve it.

You could try turning off autocorrection for your text field or text view with its autocorrectionType property—if the shortcut functionality is included in that (which seems likely), then it should get disabled as well. I’m pretty sure there’s no way to control the shortcut system itself; you might consider filing an enhancement request for it.

There is no standard way to turn off keyboard shortcuts on application level (For non jailbroken iOS).
To achieve this I stated with implementation of custom TextView with Core Text and UITextInput protocol.
Add #property for keyBoardShortCuts,
Override "tokenizer" getter method by following way to turn off shortcuts.
- (id <UITextInputTokenizer>)tokenizer {
if(self.keyBoardShortCuts)
return _tokenizer;
else
return nil;
}
If we remove tokenizer, there is be no keyboard shortcuts in custom view, even though shortcut are turned on from iOS setting.
Note: Take care of one thing, as we are not depending on tokenizer, now, in this case, use enumerateSubstringsInRange:range options:NSStringEnumerationByWords/Lines block to find out selection range for word or line.
To try this add above code in EGOTextView project to turn off default shortcuts.

From what I know, if you iphone is not jailbroken then you cannot turn it off for particular apps. It is more like a "master setting" that if changed, change applies to everything within iOS.
If it jailbroken, i know there are utility apps you can download that allow you to tweak the OS in that fashion...

Settings > General > Shortcuts. There are ready-made ones and any that you may have set up. They apply across all your iOS devices including your desktop Mac.

Related

Change Keyboard in XCUITest/Simulator

I want to change the keyboard language programatically for my XCUITests to try various different keyboards. I've tried:
XCUIApplication().launchArguments += ["-AppleLanguages", "(fr)"]
XCUIApplication().launchArguments += ["-AppleLocale", "fr_FR"]
But this only changes language and locale, but it still keeps simulator default keyboard. I know I could probably do it by going to the settings app (inside of the UITest) and just change keyboard, but I'd like to do it as an input argument or similar.
I also don't want to have all keyboard languages installed on the simulator at the same time, only the one language I choose.
How can I accomplish this?
Since you do it in Simulator, you can access the entire macOS disk space, including Simulator support files.
Each simulator has its own setting located in
$HOME/Developer/CoreSimulator/Devices/SIMULATOR_ID/data/Library/Preferences/.GlobalPreferences.plist
In this file, you can change AppleKeyboards programmatically.
New path for .plist file to change properties of keyboard from Roman Zakharov's answer:
/Users/YOUR_USER/Library/Developer/CoreSimulator/Devices/YOUR_SIMULATOR_ID/data/Library/Preferences/com.apple.keyboard.preferences.plist
Simulator ID can be found from Xcode: Window -> Devices and Simulators -> Simulators. The Identifier value is the UDID.

Is there a way to set the find options in Xcode9 via keyboard?

If you want to search for something in Xcode9, ⌘F opens the find bar, ⇧⌘F opens Find in Project in the Navigator.
However, I often want to switch between contains, matches and regex, but the dropdowns (see image) to set this are not reachable via keyboard, only mouse.
For Xcode7, there seemed to be a way (see here), but this doesn't work any more.
Does anyone know how to set these options via keyboard in Xcode9?
In macOS System Preferences -> Keyboard -> Shortcuts, you have to set Full Keyboard Access to All Controls.
After that you can Tab to all the options.
This has worked for Find in Project (⇧⌘F) since Xcode 9.0. For the "normal" find (⌘F) it was buggy util apple fixed it in Xcode 9.3.
Resolved Issues
The source editor find and replace control now
supports Full Keyboard Access. (33666790)

IPhone Safari Bookmarklet to paste clipboard into Drafts

This may be really simple, since I can't use window.getSelection on iPhone Safari, I was wondering if I could put the selection in the clipboard and use a bookmarklet to send it to Drafts (among with location.href)
The first part of the equation is quite simple:
javascript:window.location='drafts://x-callback-url/create?text='+encodeURIComponent(location.href+'%5Cn%5Cn')
As I'm a rookie, I interpreter this "create a new document in Drafts and append the current window link to the top and press return twice", now I just need to add the contents from the clipboard into this.
If I simply use the Drafts short [[clipboard]]to add the clipboard, it won't work. So I'm suspicious that I'll need a Java solution. Ideas?
unfortunately, it seems like, according to the state of things as they are right now, this is impossible. I'm better off with the clipboard in the iPhone, it seems. Thank you for checking out.
The command I was looking for is available in the iPad, you can reach it through this:
javascript:window.location='drafts://x-callback-url/create?text='+encodeURIComponent(location.href+'%5Cn%5Cn')+encodeURIComponent(window.getSelection())
According to the article by Federico Viticci, this encodeURIComponent(window.getSelection()) being the snippet that grabs the actual selection.
This happens because when you open the bookmarks tab in the iPhone, it deselects your selection and the snippet becomes useless. In the iPad, you must keep the Always Show Bookmarks option on.
The latest version of iCab Mobile has a variety of gestures, a draw-gesture feature, and a bookmarklet list called "Modules" that is (unofficially) customizable. On both the iPad and the iPhone, gesture recognition can execute JavaScript or launch apps by URL scheme without affecting your selection. It also happens to support x-callback-URL as well. :)

Custom keyboard shortcuts on iOS apps

I realize that iOS has the ability to have keyboard shortcuts (e.g.: Command-C for Copy, Command-V for Paste, etc). But is there a way to make your own keyboard shortcuts? Is there a way to implement them? I would like to know so that I can add them to some of my note-taking apps in the near-future. Thanks! :)
You'll need to modify a UIMenuController if you want to have your implementation blend in with the apple UI (It's always best to comply with the HIG!). Here's the class reference, and a nice tutorial.

App preferences in Settings.app

I'm trying to achieve something similar to the "Clear History" and "Clear Cookies" cells in my apps settings (see screenshot):
I already have a few settings implemented that use toggle switches and Multi Value options.
When I edit my Root.plist the only options for an item are group, multi value, slider, text field, title & toggle switch. I'm pretty much trying to replicate the "Clear History" (ie press it once and clear an array), it doesn't store any settings or preferences, it's a one off event.
I hope that makes sense. How is this achieved?
Thanks for your help.
There is no way to do this (yet), so you'll have to find another solution.
You could simply use a switch and check it every time your app is started for this purpose and resetting the switch programmatically (since iOS4) :)
Unfortunately you can't do this. Apple have not exposed (or at least documented) the functionality. You'll either have to find some other way doing it (a toggle that causes the reset the next time the program is launched?) or just have the button in the app itself.