little more added
This commit is contained in:
parent
0b0aaefe99
commit
a3af344991
@ -105,9 +105,14 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
|
|
||||||
var bars = [(View, NSLayoutConstraint)]()
|
var bars = [(View, NSLayoutConstraint)]()
|
||||||
|
|
||||||
|
let ordinalFormatter = NumberFormatter()
|
||||||
|
ordinalFormatter.numberStyle = .ordinal
|
||||||
|
|
||||||
for i in 0..<numberOfPages {
|
for i in 0..<numberOfPages {
|
||||||
let bar = View()
|
let bar = View()
|
||||||
bar.isAccessibilityElement = true
|
bar.isAccessibilityElement = true
|
||||||
|
let accessibleLabel = ordinalFormatter.string(from: NSNumber(value: i + 1)) ?? ""
|
||||||
|
bar.accessibilityLabel = "\(accessibleLabel) page of \(numberOfPages) page"
|
||||||
bar.widthAnchor.constraint(equalToConstant: BarsIndicatorView.indicatorBarWidth).isActive = true
|
bar.widthAnchor.constraint(equalToConstant: BarsIndicatorView.indicatorBarWidth).isActive = true
|
||||||
bar.backgroundColor = isEnabled ? (i == currentIndex ? currentIndicatorColor : indicatorColor) : disabledIndicatorColor
|
bar.backgroundColor = isEnabled ? (i == currentIndex ? currentIndicatorColor : indicatorColor) : disabledIndicatorColor
|
||||||
let barHeight = i == currentIndex ? BarsIndicatorView.indicatorBarHeight.selected : BarsIndicatorView.indicatorBarHeight.unselected
|
let barHeight = i == currentIndex ? BarsIndicatorView.indicatorBarHeight.selected : BarsIndicatorView.indicatorBarHeight.unselected
|
||||||
|
|||||||
@ -22,7 +22,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
public var moleculeName: String?
|
public var moleculeName: String?
|
||||||
public var numberOfPages: Int = 0
|
public var numberOfPages: Int = 0
|
||||||
|
|
||||||
// Sets the current Index to focus on.
|
/// Sets the current Index to focus on.
|
||||||
public var currentIndex: Int = 0
|
public var currentIndex: Int = 0
|
||||||
public var isAnimated: Bool = true
|
public var isAnimated: Bool = true
|
||||||
public var hidesForSinglePage: Bool = false
|
public var hidesForSinglePage: Bool = false
|
||||||
@ -52,7 +52,6 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
case isEnabled
|
case isEnabled
|
||||||
case disabledIndicatorColor
|
case disabledIndicatorColor
|
||||||
case indicatorColor
|
case indicatorColor
|
||||||
case currentIndicatorColor
|
|
||||||
case position
|
case position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ open class NumericIndicatorView: CarouselIndicator {
|
|||||||
let arrow = Arrow(model: ArrowModel(), degrees: 180)
|
let arrow = Arrow(model: ArrowModel(), degrees: 180)
|
||||||
arrow.isAccessibilityElement = true
|
arrow.isAccessibilityElement = true
|
||||||
arrow.accessibilityLabel = "Left arrow"
|
arrow.accessibilityLabel = "Left arrow"
|
||||||
arrow.accessibilityHint = "Double tap to swipe carousel left"
|
arrow.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||||
arrow.pinHeightAndWidth()
|
arrow.pinHeightAndWidth()
|
||||||
return arrow
|
return arrow
|
||||||
}()
|
}()
|
||||||
@ -36,7 +36,7 @@ open class NumericIndicatorView: CarouselIndicator {
|
|||||||
let arrow = Arrow(model: ArrowModel())
|
let arrow = Arrow(model: ArrowModel())
|
||||||
arrow.isAccessibilityElement = true
|
arrow.isAccessibilityElement = true
|
||||||
arrow.accessibilityLabel = "Right arrow"
|
arrow.accessibilityLabel = "Right arrow"
|
||||||
arrow.accessibilityHint = "Double tap to swipe carousel right"
|
arrow.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||||
arrow.pinHeightAndWidth()
|
arrow.pinHeightAndWidth()
|
||||||
return arrow
|
return arrow
|
||||||
}()
|
}()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user