简体   繁体   中英

Set voice over focus on UITextView

如何在iOS 6中对我的元素(如UITextView )设置过大的声音?可以吗?

Very simple. Just do this:

UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, textView);

Note that it may not work, depending on where and when you use it. If you're trying to set the focus to a particular element from viewDidLoad , the code probably won't work correctly. This is because VoiceOver makes its own attempt to set the VoiceOver focus on an element initially; if VoiceOver does this before it processes your attempt to set focus, your code will work. But if VoiceOver gets around to setting the initial focused element after it processes your attempt, your code will appear to fail.

A somewhat more reliable way to do this in viewDidLoad is to use performSelector:withObject:withDelay: , to ensure that your call is processed after VoiceOver's initial focus setting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM