Suggestions bar with AccessoryView for Keyboard extension on iOS - ios

Keyboard height, that available in Keyboard extension is to small for inserting suggestions bar there. I found that several users on AppDevForum offered to use AccessoryView. But for using it we need access to TextField, with seems as impossible, eventually now. So does someone know how to get that access or how to solve this problem?

I think it's Apple's intention to not allow 3rd party keyboard to render beyond the default area, any hack way of doing it may cause rejections during app review... But try UITextDocumentProxy see if you can access text view from it?

Related

Prevent UIButton showsTouchWhenHighlighted from altering VoiceOver description

Setting showsTouchWhenHighlighted, e.g. via the IB option "Shows Touch On Highlight," on a button without a title will alter the VoiceOver description. After reading the accessibility label, VoiceOver beeps and announces a description of the image. Is there a way to disable this behavior?
Setting the accessibilityContainerType value to UIAccessibilityContainerTypeSemanticGroup works and that's great 👏 but I'm not sure that
this is the goal of this element.
Even if a button my be seen as a container, I understood this instance property dealt with
data-based containers rather. 🤔
I looked into your problem that arouse my curiosity and couldn't find out an appropriate solution with the Apple API unfortunately.
First, I thought that this solution may help but it didn't work as you mentioned in your comment... thanks. 😉
Apparently, when the showsTouchWhenHighlighted property is used, there's an added view inside the button that renders the glow touch ⟹ this is a UIButtonBarPressedIndicator image you can detect thanks to the Debug Hierarchy in Xcode for instance. 👍
This new image seems to put the default value of the accessibility trait property of your button image even if you have already changed it programmatically. 🤯
So, in order to avoid VoiceOver from using the screen recognition and reading out some useless information, I made something very ugly but efficient to reach your goal in the viewDidAppear for instance (see the 'basic operations' sheet of this link):
myButton.subviews.forEach{$0.accessibilityTraits = .none}
Bad hack due to a native problem of implementation or a simple line of code that anyone can understand, this solution removes every possible VoiceOver screen recognition from the button 🥳... and I'm still interested if you can explain a little bit the reason why your solution works, please. 😉
Set accessibilityContainerType = UIAccessibilityContainerTypeSemanticGroup.

iOS App: Possible to make keyboard recommendations?

In an iOS application, is it possible to make own keyboard suggestions if the user taps a specific UITextField? The suggestion should only appear if the UITextField is empty.
By keyboard recommendations I mean the Predictive Keyboard:
Swift code is preferred.
Thanks!
I don't think you can provide suggestions to the actual keyboard so they get presented, but what you can do is write your own inputAccessoryView to be there instead, and handle the tapping/appending of text yourself, and possibly disable the completion from the keyboard. This is essentially what the messaging apps do to present a bar with buttons to add photos and attachments when writing.
Since you don't mention what you're trying to accomplish I don't know if this would make sense. Let me know if you want me to elaborate on how to do this in code.

Get Instance of iOS Keyboard Without First Responder

My application uses Cordova so a number of functions are performed in the webview.
There is an object in one of my webviews that brings up the keyboard.
All the documentation and SO answers on changing the keyboard involve setting the values of the first responder. My problem is, on the native side, I do not have the first responder.
So my question is:
Can I get access to the keyboard object without the first responder, and if so how?
Swift/Obj-c answers welcome
You can use UIReturnKeyType for native controls, but unfortunately there is no way to control the return key for text fields within a webview. You might be able to figure out some sort of hacky solution though.
One idea is to manually modify the keyboard views. There's an Apache plugin that uses this to hide the form accessory bar on keyboards. You can see how they do it here. You would have to find the return key's view instead of the form bar though. Of course this isn't supported and is likely to break at some point.
Another option might be to use swizzling to modify UIWebView to use the UIReturnKeyType you want. You'd have to look into dumping the headers to find a possible starting point. This option also has the potential to break along with a chance Apple rejects your app.

URL Visible in UIActivityViewController

I've seen this used in some apps and I can't seem to figure out how it's done - there seems to be nothing to set. When I set the url to share, it doesn't pop up automatically either, and I can't find any reference to it anywhere on the Internet which makes me feel like an idiot. Any possibilities? It's not urgent anyway I'm just curious. Thanks.
Screenshot of iOS Device with the UIActivityViewController visible with the URL bar:
http://twitter.com/SunburstEnzo/status/617736706402484224/photo/1
Edit: I can't believe I need 10 reputation to show you my problem.
There's no built-in way to do this. However, there's a third-party component named JDSActivityVC which enables you to achieve this effect.
It's just a subclass of UIActivityViewController that adds a custom UIView with an UILabel.

Disabling Split Option in iOS5 Keyboard

I am facing problem in my app because of the new split keyboard option in iOS5.
Is there any way we can hide or disable this option in objective C?.
Thanks in advance.
Seems like the split keyboard does not use the same functions as regular keyboard. see here.
missing kb notifications
Here's the problem: You can iterate through the keyboard subviews and hide the button but you can't control the state of the keyboard when going from one app to the next. It would get really tricky and sneaky to force the private api to call when the application did enter foreground and the keyboard became active.
You could do this but apple may deny you from the store.
Fix your view to account for the keyboard movement. Your users will dock or unsplit the keyboard when there's clear disruption in the UI due to the keyboard placement.
Other solutions could be to move the entire view that requires keyboard placement to be docked or undocked using the notifications. See other posting here: StackOverflow article

Resources