From f8ec75c7d514f98909707d6cb2d680194af655d5 Mon Sep 17 00:00:00 2001 From: panxi Date: Thu, 2 May 2019 16:34:21 -0400 Subject: [PATCH] fix bug for tabbar --- MVMCoreUI/Containers/TabBarController/TopTabbar.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Containers/TabBarController/TopTabbar.m b/MVMCoreUI/Containers/TabBarController/TopTabbar.m index e1c96c20..c52e9d66 100644 --- a/MVMCoreUI/Containers/TabBarController/TopTabbar.m +++ b/MVMCoreUI/Containers/TabBarController/TopTabbar.m @@ -193,7 +193,7 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; [label layoutIfNeeded]; label.baselineAdjustment = UIBaselineAdjustmentAlignCenters; - [self setCellAccessibility:cell title:label.text isSelected:NO]; + [self setCellAccessibility:cell title:label.text isSelected:NO indexPath:indexPath]; if (indexPath.row == self.selectedIndex) { label.textColor = [UIColor mfTomatoRed]; @@ -403,19 +403,19 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; [self.delegate topTabbar:self didSelectItemAtIndex:indexPath.row]; } - [self setCellAccessibility:cell title:label.text isSelected:YES]; + [self setCellAccessibility:cell title:label.text isSelected:YES indexPath:indexPath]; } - (void)reloadData { [self.collectionView reloadData]; } -- (void)setCellAccessibility:(UICollectionViewCell *)cell title:(NSString *)title isSelected:(BOOL)isSelected { +- (void)setCellAccessibility:(UICollectionViewCell *)cell title:(NSString *)title isSelected:(BOOL)isSelected indexPath:(NSIndexPath *)indexPath { cell.isAccessibilityElement = NO; cell.contentView.isAccessibilityElement = YES; NSString *accKey = isSelected ? @"toptabbar_tab_selected" : @"AccTab"; NSString *accLabel = [title stringByAppendingString:[MVMCoreUIUtility hardcodedStringWithKey:accKey]]; - NSString *accString = [accLabel stringByAppendingString:[NSString stringWithFormat:[MVMCoreUIUtility hardcodedStringWithKey:@"AccTabIndex"], self.selectedIndex + 1, [self.datasource numberOfTopTabbarItems:self]]]; + NSString *accString = [accLabel stringByAppendingString:[NSString stringWithFormat:[MVMCoreUIUtility hardcodedStringWithKey:@"AccTabIndex"], indexPath.row + 1, [self.datasource numberOfTopTabbarItems:self]]]; cell.contentView.accessibilityLabel = accString; NSString *accHint = isSelected ? nil : [MVMCoreUIUtility hardcodedStringWithKey:@"AccTabHint"]; [cell.contentView setAccessibilityHint:accHint];