fix bug for tabbar
This commit is contained in:
parent
2fdd88356b
commit
f8ec75c7d5
@ -193,7 +193,7 @@ static NSString * const COLLECTION_CELL_ID = @"cell";
|
|||||||
[label layoutIfNeeded];
|
[label layoutIfNeeded];
|
||||||
label.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
|
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) {
|
if (indexPath.row == self.selectedIndex) {
|
||||||
label.textColor = [UIColor mfTomatoRed];
|
label.textColor = [UIColor mfTomatoRed];
|
||||||
@ -403,19 +403,19 @@ static NSString * const COLLECTION_CELL_ID = @"cell";
|
|||||||
[self.delegate topTabbar:self didSelectItemAtIndex:indexPath.row];
|
[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 {
|
- (void)reloadData {
|
||||||
[self.collectionView 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.isAccessibilityElement = NO;
|
||||||
cell.contentView.isAccessibilityElement = YES;
|
cell.contentView.isAccessibilityElement = YES;
|
||||||
NSString *accKey = isSelected ? @"toptabbar_tab_selected" : @"AccTab";
|
NSString *accKey = isSelected ? @"toptabbar_tab_selected" : @"AccTab";
|
||||||
NSString *accLabel = [title stringByAppendingString:[MVMCoreUIUtility hardcodedStringWithKey:accKey]];
|
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;
|
cell.contentView.accessibilityLabel = accString;
|
||||||
NSString *accHint = isSelected ? nil : [MVMCoreUIUtility hardcodedStringWithKey:@"AccTabHint"];
|
NSString *accHint = isSelected ? nil : [MVMCoreUIUtility hardcodedStringWithKey:@"AccTabHint"];
|
||||||
[cell.contentView setAccessibilityHint:accHint];
|
[cell.contentView setAccessibilityHint:accHint];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user