i am working on a iOS application with accessibility support. At some point in my application flow, i present an alert view. After presenting the view, i want to focus on the view using UIAccessibilityPostNotification, however the notification seems to get overridden.
[alertView show];
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,alertView.somesubView);
However i do not see the effect of this notification. The accessibility focus goes to some other view object in the background.
However, when i use dispatch_after with 0 delay, it works
[alertView show];
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW,0 * NSEC_PER_SEC);
dispatch_after(delay,dispatch_get_main_queue(), ^void(){
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,alertView.somesubView);
});
Can someone explain what is the reason ?