| ## Accessibility |
| |
| To help ensure your bottom navigation item is accessible to as many users as possible, please |
| be sure to review the following recommendations: |
| |
| `-accessibilityLabel` The label will be the title of the UITabBarItem. Currently you can't set this to a custom value. |
| |
| `-accessibilityValue` Set an appropriate `accessibilityValue` value if your item has a badge value. |
| For example, an item with an inbox icon with a badge value for how many emails are unread. You should explicitly |
| set the `accessibilityValue` when the badge value doesn't provide enough context. For example, in an inbox |
| example simply having the value "10" doesn't provide enough context, instead the accessibility value should explain |
| what the badge value symbolizes. The default value if there is a badge value and you haven't set any |
| `accessibilityValue` will be that the `accessibilityValue` is the `badgeValue`. |
| |
| #### Swift |
| ```swift |
| tabBarItem.accessibilityValue = "10 unread emails" |
| ``` |
| |
| #### Objective-C |
| ```objc |
| tabBarItem.accessibilityValue = @"10 unread emails"; |
| ``` |
| |
| ### Minimum touch size |
| |
| Make sure that your bottom navigation bar respects the minimum touch area. The Material spec calls for |
| [touch areas that should be least 48 points high and 48 wide](https://material.io/design/layout/spacing-methods.html#touch-click-targets). |
| |
| #### Swift |
| ```swift |
| override func viewWillLayoutSubviews() { |
| super.viewWillLayoutSubviews() |
| let size = bottomNavBar.sizeThatFits(view.bounds.size) |
| let bottomNavBarFrame = CGRect(x: 0, |
| y: view.bounds.height - size.height, |
| width: size.width, |
| height: size.height) |
| bottomNavBar.frame = bottomNavBarFrame |
| } |
| |
| ``` |
| |
| #### Objective-C |
| ```objc |
| - (void)viewWillLayoutSubviews { |
| [super viewWillLayoutSubviews]; |
| CGSize size = [_bottomNavigationBar sizeThatFits:self.view.bounds.size]; |
| CGRect bottomNavBarFrame = CGRectMake(0, |
| CGRectGetHeight(self.view.bounds) - size.height, |
| size.width, |
| size.height); |
| _bottomNavigationBar.frame = bottomNavBarFrame; |
| } |
| |
| ``` |