问题
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