How to add UIAccessibilityTraitHeader properly?

江枫思渺然 提交于 2021-02-11 07:10:07

问题


I am working with objective-c/swift and interface builder trying to make my application navigation accessible. I cannot figure out how to get my header to work when you use the accessibility rotor and select "headings." My heading title is set in Interface Builder (IB). Within IB its set in a Navigation Bar > UINavigationItem > Title attribute. I think what I want to do is find a way to add the UIAccessibilityTraitHeader to the UINavigationItem, but you cant do that in IB. I also tried making an outlet then adding the trait manually in viewDidLoad method. This is not working. If anybody could help that would be great!

@IBOutlet weak var menuTitle: UINavigationItem!
override dynamic func viewDidLoad() {
self.menuTitle.accessibilityTraits |= UIAccessibilityTraitHeader;
}

回答1:


I found out this is a defect with the iOS Simulator (X-Code 6.2). It does not show "Headers" as a trait. It worked fine when I loaded it onto a device and tested it.



来源:https://stackoverflow.com/questions/29990256/how-to-add-uiaccessibilitytraitheader-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!