public
Created

MonoTouch Accessability helper

  • Download Gist
gistfile1.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
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"));
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.