Why is UIAccessibility.post(notification: .announcement, argument: “arg”) not announced in voice over?

前端 未结 4 2271
温柔的废话
温柔的废话 2021-02-14 20:34

When using Voice Over in iOS, calling UIAccessibility.post(notification:argument:) to announce a field error doesn\'t actually announce the error.

I have a

4条回答
  •  醉酒成梦
    2021-02-14 20:54

    This is an admittedly hacky solution, but I was able to prevent the system announcement from pre-empting my own by dispatching to the main thread with a slight delay:

    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
      UIAccessibility.post(notification: .announcement, argument: "")
    }
    

提交回复
热议问题