问题
Any way to decide which element gets focus first? I tried use the second parameter in the
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, element);
but with no success.
回答1:
Using the UIAccessibilityPostNotification
method is the proper way to get your purpose.
There are several types of change notifications but the two most commonly used are :
- UIAccessibilityLayoutChangedNotification : notifies that a part of the page has changed with 2 possible incoming parameters (a NSString or a UIObject). With a NSString, the notification behaves like a UIAccessibilityAnnouncementNotification with a VoiceOver vocalization. With a UIObject, focus is shifted to the user interface element. This notification is very similar to the UIAccessibilityAnnouncementNotification but should come as a result of dynamic content being deleted or added to the current view.
- UIAccessibilityScreenChangedNotification : notifies that the whole page has changed including nil or a UIObject as incoming parameters. With nil, the first accessible element in the page is focused. With a UIObject, focus is shifted to the specified element with a VoiceOver. This notification comes along with a vocalization including a sound like announcing a new page.
Your problem may be the element
type you specify in your line of code apparently because it seems perfectly correct.
来源:https://stackoverflow.com/questions/12807468/default-uiaccessibilityelement-after-screen-change