Making a UIWebView accessible - iphone

Simple question.
I have a UIWebView. It displays plain html text with a few headers. I want VoiceOver to read the content of this web view.
It would also be nice if I could make use of VoiceOver's rotor to let the user scroll through content using headers, but I won't get greedy yet.
Any input is appreciated.

What I have learned: If the view that the UIWebView is contained in is marked as accessibility enabled then voiceover will not pass through to the UIWebView.

UIWebView should be accessible with VoiceOver without you doing anything.

read this one :
http://arstechnica.com/apple/guides/2010/02/iphone-voiceservices-looking-under-the-hood.ars/

From the iOS developer documentation for accessibility.
A user interface element is accessible if it reports itself as an accessibility element. Although being accessible is not enough to make a user interface element useful to VoiceOver users, it represents the first step in the process of making your application accessible.
You can do something like this (or manually set a label):
[_view setIsAccessibilityElement:YES];
There is a lot of information here. I suggest that you consult this.
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html#//apple_ref/doc/uid/

Related

Is there an existing iOS component to type in a UITextView? [duplicate]

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement

Woodwing: how to trigger the ModalViewController using custom web/html embedded content

Using Woodwing, we have a page that has custom html in it, using the custom web widget.
That widget has an anchor tag, that when tapped, opens a page in safari.
However, if we create the same page using the HTML widget, and a link overlay, that triggers a ModalView to display.
I'm assuming this has something to do with WoodWing's (un)documented protocols for the anchor tags, that are captured by the WoodWing shell application and used to trigger the "ModalView" display. Since everything in Woodwing generates an XML that is parsed when the app is loaded, and I've done numerous applications, this seems reasonable. However, there is very little technical documentation.
My question is: does anyone know any documentation on those protocols, or a way I can use custom-html to trigger the ModalView? I've tried replacing "http" with "ww" but no dice. It's possible it's javascript but I'm suspecting protocols...
The UIWebViewDelegate defines the webView:shouldStartLoadWithRequest:navigationType: method that your view controller can implement. In this implementation, your code shoudl decide if it wants to handle the request (user click) or let the UIWebView handle it normally.
For displaying a modal as a result of a click, this method would display the modal and return NO.
The default HTML widget implementation doesn't support this out of the box. There are two ways that you can do to achieve this;
Implement what they call a 'custom object'. They documented this feature, if you have access to their documentation this should be relatively easy to figure out. It allows you to write native objects and inject them into both the .ofip format and the application.
Implement a modal dialog within the widget (in HTML). This is less convenient but possible to do (if you have a fullscreen widget).
Create the specific URL for open as you mention in your comment(ww://string.string).
Then in UIWebView Delegate method (webView: shouldStartLoadWithRequest: navigationType:) get the redirect URL. If redirect URL is equal to you mention before then perform your action.
Let me know if this answer help you.
Thanks,

The best way to create an "instruction view" for my app?

Im planning on adding a instructions view to my app. Whats the best way to do it? Load a PDF into a webview or..?
Please suggest anything I might find helpful.
I also want it to look good for the user, not to plain.
You might want to consider using a UIWebView to load content that resides on your web server. The downside is that the user needs network connectivity to see the instructions and you need to know your way around at least some web development. However, you'll be able to use HTML+CSS+Javascript to create interesting content and you'll be able to change/update/correct that content without going through the hassle of releasing the app again.
I've seen a few apps put screenshots into a scrollview with a paging control. I really like that design, and there are plenty of tutorials online that explain how to do this.
You can implement instruction view different ways:
1) Just put textview and make scroll. (very simple)
2) Design the HTML instruction, and load it to the webview. (medium in look vise)
3) Create attractive design for instruction pages and implement scroll view with pages. (very attractive)
Please review above point and let me know in case of query.
Thanks.
I would use a info button (the lowercase "i" button, can be accessed by inserting "Round Rect Button" and changing type to one of the "Info" buttons or in code you could init a button with type: "UIButtonTypeInfoDark" or "UIButtonTypeInfoLight") on your main or first view controller. Inside that view you could put an UITextView with editing OFF and that would contain all your instructions that the user could scroll through and get to quickly, easily, and intuitively

Disabling visible links in UIWebView

I have a number of web views in my app in which I need to be careful about allowing further HTML links.
I disallow links in the delegate method shouldStartLoadWithRequest. This works fine, except for one thing. In the web view, the links are still highlighted in blue. So the user naturally thinks they are active links, but when selected, I disallow the link from the delegate method. This leads to confusion for the user.
Is there a way for me to disable the link color, so text does not show as blue when it contains a link within a UIWebView?
Try injecting Javascript into the UIWebView to change the appearance of the links.
Removing the href from all anchors should clear the formatting.
Here's some Javascript to get you started if you need it:
for(a in document.getElementsByTagName("a")) { a.href= ""; }
This will do it:
self.webView.dataDetectorTypes = UIDataDetectorTypeNone;
For swift 3:
Try removing the types you don't want to show as link from webView.dataDetectorTypes
webView.dataDetectorTypes.remove(UIDataDetectorTypes.all)

Is there an iPhone equivalent to the NSTokenField control?

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement