What is this 'block' called in a UITextView? - ios

I am looking at creating a contained block like in the notes app Bear. When you click the ‘hashtag’ icon in the Keyboard Accessory it adds a ‘contained block’ in the text view. You can then continue to write text but if you backspace it selects the whole block as if it’s a single element? It also shows it with a background colour. When you click the tag icon what is that ‘contained block’ element called? Here is the example: https://imgur.com/a/kpcK5En

That's definitely a custom view.
I searched their site for 3rd party libraries but can't seem to find the specific one that does this behavior. Tbf, I just skimmed. But there's a possibility it could be their own code.
3rd-party libraries used: https://bear.app/faq/Extra/Libraries%20used%20in%20Bear/

Related

VoiceOver : is 'accessibilityActivationPoint' really useful?

I tried and understood what could be the purpose of the accessibilityActivationPoint but in vain.
When a focused accessible element is activated, that property should indicate VoiceOver the specific area it's going to activate when a user double-taps the element (Apple reference) : for me, it's always the selected element itself.
I understood the selected element is considered as a block by VoiceOver, whatever the other elements inside. Once a double tap occurs to activate this block, VoiceOver calls accessibilityActivate to know what to perform (Apple reference).
1/. I've written many tests by creating a custom view including a switch control. Whatever the value of accessibilityActivationPoint inside (or outside on another switch control), the value of the switch control never changes. Is it a proper use case or am I totally wrong ?
2/. When we gather many elements inside one accessible element, how is VoiceOver able to activate one of them while they aren't accessible by definition ? Pointing one of them thanks to the accessibilityActivationPoint should work ?
Personally, I couldn't make it work and think that I'm really confusing accessibilityActivationPoint and accessibilityActivate.
Any help would be appreciated, thanks in advance.
Yes, you have the right idea with accessibilityActivate and accessibilityActivationPoint. Note that, in order for it to work, the accessibilityActivationPoint needs to be a point within the Control that you are trying to activate in on-screen coordinates (use the convert function!).
I think the short answer is "yes" to answer your second question, but, just to clear up confusion about when Accessibility Activation Point is useful, I'll go into more detail about it.
By default (aka, the default behavior for AcessibilityActivate()), when any view is activated by VoiceOver, VoiceOver will send a "tap gesture" to the center of the view. The position of this "tap gesture" can be changed by updating the accessibilityActivationPoint attribute on a view. Below, I have an example for how this property can be used.
Let's say you have a blank button (in the image below, the button is the gray box) next to some text:
For the purpose of accessibility, you may want to make the entire view that holds the button and text an Accessibility Element (so that VoiceOver users can easily understand that the button is associated with the text "Worldspace Attest"). In the image below, I am using Accessibility Inspector to show that the view holding both of these elements is an Accessibility Element.
Notice in these images that the button is not in the center of the view, but rather, it is to the right. When you activate this view using VoiceOver, the view will not select the button; instead, it will send a "tap" to the center of the view (which is the same as tapping the text, which does not do anything). In order to select the button, you have to set the view's accessibilityActivationPoint to be the on-screen coordinates of the button:
view.accessibilityActivationPoint = self.convert(button.center, to: UIApplication.shared.windows.first)
This should make it so that this button is usable by a VoiceOver user.
I hope this information clears up any confusion about the Accessibility Activation Point property. The example I used above can be found in this repository in the "Active Control Name" demo.

iOS - What do we call the type of menu which pops up, as seen when highlighting text

When you highlight text in iOS, a menu is shown giving options such as cut and copy, it floats above the text and is black. What is this called and how can i implement it in a tableview (to give options when a row is selected)
You mean this, this is a UIMenuController
https://developer.apple.com/library/ios/documentation/iPhone/Reference/UIMenuController_Class/
another bit of info:
http://nshipster.com/uimenucontroller/
How to use it:
https://www.captechconsulting.com/blogs/getting-started-with-uimenucontroller-in-ios-5
An actual example already coded up for you:
https://github.com/jszumski/uimenucontroller-example
It is called UIMenuController.
This menu is referred to as the editing menu. When you make this menu visible, UIMenuController positions it relative to a target rectangle on the screen; this rectangle usually defines a selection. The menu appears above the target rectangle or, if there is not enough space for it, below it.
You can also provide your own menu items via the menuItems property. When you modify the menu items, you can use the update method to force the menu to update its display.

iOS Custom keyboard - Not able to move focus to and fro between custom keyboard's search field and the third party app’s search field

We are designing a custom keyboard on iOS with a TextField (Search Field) on it.
Problem - Not able to move the focus to and fro between our custom keyboard's search field and the third party app’s search field.
when the focus comes to the custom keyboard search field it never goes back to the Parent App's search field.
PS: I have seen the keyboard apps like Popkey and Fleksy successfully doing this.
I could find out a workaround to achieve required functionality by keeping a Label instead of textField. With this work around we don't have to worry about the focus issue. Once user starts typing, we need to catch the event and update the text in label.
Hope this will help if some one is still looking for a solution to this problem.

UITextVew tap in the middle of a word and place the cursor there

In the common behavior of UITextVew if the user taps in the middle of a word the cursor gets placed at the beginning of that word, or in other cases it selects the whole word.
I would like to entirely disable this and just let the user tap anywhere in the UITextVew and place the cursor just there.
Also I would appreciate to know if this is possible too for a UIWebView with contentEditable enabled.
Thanks in advance.
To get this behavior you have to build the text view yourself using core text. Or your only support iOS7. There you will have TextKit.

Webkit shadows textarea when tapping on element

I'm building an iOS app that uses a webview in one place. When the user taps on an textarea and the keyboard appears the textarea get a shadowing highlight effect and then goes back to normal. Please note that I'm not talking about webkit-appearance och outline, but the shadow that covers the whole textarea being tapped.
I'm guessing this is some kind of accessibility feature. Still, it mess up my animation and makes the whole view look like crap.
Does anyone know if it's possible to remove this highlight shadow?
You can disable it by setting the css attribute -webkit-tap-highlight-color to rgba(0,0,0,0);
But as you mentioned it is a usability feature, so you should not turn it off. ;)
See:
http://www.yuiblog.com/blog/2010/10/01/quick-tip-customizing-the-mobile-safari-tap-highlight-color/

Resources