From ee28d528ea66b3a83c467956b24fc6ce56e146c8 Mon Sep 17 00:00:00 2001 From: Fabio Tacke Date: Tue, 12 Dec 2017 19:43:01 +0100 Subject: [PATCH] Add VoiceOver support to MenuView --- Pod/Classes/MenuView.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Pod/Classes/MenuView.swift b/Pod/Classes/MenuView.swift index 6eba4054..be7708cd 100644 --- a/Pod/Classes/MenuView.swift +++ b/Pod/Classes/MenuView.swift @@ -81,6 +81,10 @@ open class MenuView: UIScrollView { internal init(menuOptions: MenuViewCustomizable) { super.init(frame: CGRect(x: 0, y: 0, width: 0, height: menuOptions.height)) + if #available(iOS 10.0, *) { + self.accessibilityTraits = UIAccessibilityTraitTabBar + } + self.menuOptions = menuOptions commonInit({ self.constructMenuItemViews(menuOptions) }) @@ -121,9 +125,12 @@ open class MenuView: UIScrollView { if let previousMenuItemView = previousMenuItemView, page != previousPage { + previousMenuItemView.titleLabel.accessibilityTraits = UIAccessibilityTraitStaticText onMove?(.willMoveItem(to: menuItemView, from: previousMenuItemView)) } + menuItemView.titleLabel.accessibilityTraits = UIAccessibilityTraitSelected + update(currentPage: page) let duration = animated ? menuOptions.animationDuration : 0