Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Accessibility: need help with UIAccessibilityPostNotification binding

There are no bindings for various UIAccessibility* items. Nic Wise created a ticket some time ago regarding this:

You can use UIResponder.SetValueForKey() to set some accessibility items programatically, but I also need UIAccessibilityPostNotification().

Has anyone created a binding for UIAccessibilityPostNotification or can someone from Xamarin help me create one?

I'm really surprised there is not more support for voice-over accessibility in MonoTouch. IMHO it is very important to support this in our apps. Nic created a great seminar on accessibility for MonoTouch and Android. His extension methods are here.

I've created some extension methods to set accessibility traits which are used to indicate things like a control is a button, link, selected, etc. I posted them to a StackOverflow question.


  • I used P/Invoke to create an interface to:

    UIKIT_EXTERN void UIAccessibilityPostNotification(UIAccessibilityNotifications notification, 
        id argument);

    Which might be used like so in Objective-C:

        @"hello world");

    My simple C# code to speak text when VoiceOver is enabled:

    using System;
    using MonoTouch;
    using MonoTouch.Foundation;
    using System.Runtime.InteropServices;
    namespace Free.MonoTouch
        public static class UIAccessibility
            [DllImport(Constants.UIKitLibrary, EntryPoint="UIAccessibilityPostNotification")]
            public extern static void PostNotification(uint notification, IntPtr id);
            public static void PostVoiceOver(string textToSpeak)
                PostNotification(1008, new NSString(textToSpeak).Handle);

    I did hard code UIAccessibilityAnnouncementNotification value of 1008 which isn't good. There might be a way to extract an exported global defined in UIKit as described here:

    But just creating a small Objective-C library that implements getUIAccessibilityAnnouncementNotification() et all or simply PostVoiceOver() would probably be easier. Any thoughts?

    I hope that my work is temporary and full accessibility bindings can be added ASAP. There are a lot of other neat accessibility features and some that should be implemented as events:

    • UIAccessibilityAnnouncementDidFinishNotification - posted by UIKit when the system has finished reading an announcement
    • UIAccessibilityVoiceOverStatusChanged - posted by UIKit when VoiceOver starts or stops.
Sign In or Register to comment.