Created
September 2, 2012 14:00
-
-
Save nicwise/3599186 to your computer and use it in GitHub Desktop.
MonoTouch Accessability helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MonoTouch.UIKit; | |
using MonoTouch.Foundation; | |
namespace BigTed.Utilities | |
{ | |
public static class AccessabilityExtensions | |
{ | |
/// <summary> | |
/// Description A succinct label that identifies the accessibility element, in a localized string. | |
/// </summary> | |
public static void SetAccessabilityLabel(this UIResponder control, string text) | |
{ | |
control.SetValueForKey(new NSString(text), new NSString("accessibilityLabel")); | |
} | |
/// <summary> | |
/// A brief description of the result of performing an action on the accessibility element, in a localized string | |
/// </summary> | |
public static void SetAccessabilityHint(this UIResponder control, string text) | |
{ | |
control.SetValueForKey(new NSString(text), new NSString("accessibilityHint")); | |
} | |
/// <summary> | |
/// Disables the accessibility. Handy for hiding controls you dont want to show | |
/// </summary> | |
public static void DisableAccessibility(this UIResponder control) | |
{ | |
control.SetValueForKey(NSNumber.FromBoolean(false), new NSString("isAccessibilityElement")); | |
} | |
/// Disables the accessibility. Handy for hiding controls you dont want to show | |
/// </summary> | |
public static void EnableAccessibility(this UIResponder control) | |
{ | |
control.SetValueForKey(NSNumber.FromBoolean(true), new NSString("isAccessibilityElement")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment