This commit is contained in:
Kevin G Christiano 2020-05-05 14:31:54 -04:00
parent 1d43a40acb
commit bcea1d4f25
2 changed files with 7 additions and 7 deletions

View File

@ -197,7 +197,7 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
currentIndex = model.currentIndex currentIndex = model.currentIndex
isEnabled = model.enabled isEnabled = model.enabled
adjustAccessibilityValue(of: currentIndex + 1, total: numberOfPages) formatAccessibilityValue(index: currentIndex + 1, total: numberOfPages)
} }
//-------------------------------------------------- //--------------------------------------------------
@ -206,15 +206,15 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
open override func accessibilityIncrement() { open override func accessibilityIncrement() {
accessibilityAdjust(toPage: currentIndex + 1) adjustAccessibility(toPage: currentIndex + 1)
} }
open override func accessibilityDecrement() { open override func accessibilityDecrement() {
accessibilityAdjust(toPage: currentIndex - 1) adjustAccessibility(toPage: currentIndex - 1)
} }
func adjustAccessibilityValue(of index: Int, total: Int) { func formatAccessibilityValue(index: Int, total: Int) {
let ordinalFormatter = NumberFormatter() let ordinalFormatter = NumberFormatter()
ordinalFormatter.numberStyle = .ordinal ordinalFormatter.numberStyle = .ordinal
@ -226,9 +226,9 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
accessibilityValue = String(format: accessibleFormat, accessibleIndex, total) accessibilityValue = String(format: accessibleFormat, accessibleIndex, total)
} }
func accessibilityAdjust(toPage index: Int) { func adjustAccessibility(toPage index: Int) {
adjustAccessibilityValue(of: index, total: numberOfPages) formatAccessibilityValue(index: index, total: numberOfPages)
if (index < numberOfPages && index >= 0) || carouselIndicatorModel?.alwaysSendAction ?? false { if (index < numberOfPages && index >= 0) || carouselIndicatorModel?.alwaysSendAction ?? false {
carouselIndicatorModel?.animated = false carouselIndicatorModel?.animated = false

View File

@ -120,7 +120,7 @@ open class NumericIndicatorView: CarouselIndicator {
open override func updateUI(previousIndex oldIndex: Int, newIndex: Int, totalCount: Int, isAnimated: Bool) { open override func updateUI(previousIndex oldIndex: Int, newIndex: Int, totalCount: Int, isAnimated: Bool) {
pageCount.text = "\(newIndex + 1)/\(totalCount)" pageCount.text = "\(newIndex + 1)/\(totalCount)"
adjustAccessibilityValue(of: newIndex + 1, total: totalCount) formatAccessibilityValue(index: newIndex + 1, total: totalCount)
layoutIfNeeded() layoutIfNeeded()
} }
} }