correcting layout issue

This commit is contained in:
Kevin G Christiano 2020-05-07 10:38:10 -04:00
parent 38e9141810
commit 0501c2daae
4 changed files with 30 additions and 10 deletions

View File

@ -98,6 +98,18 @@ open class BarsIndicatorView: CarouselIndicator {
])
}
open override func layoutSubviews() {
super.layoutSubviews()
if barReferences.isEmpty {
generateBars()
updateUI(previousIndex: previousIndex,
newIndex: currentIndex,
totalCount: numberOfPages,
isAnimated: false)
}
}
//--------------------------------------------------
// MARK: - Methods
//--------------------------------------------------

View File

@ -66,6 +66,17 @@ open class NumericIndicatorView: CarouselIndicator {
pageCount.updateView(size)
}
open override func layoutSubviews() {
super.layoutSubviews()
if pageCount.text?.isEmpty == nil {
updateUI(previousIndex: previousIndex,
newIndex: currentIndex,
totalCount: numberOfPages,
isAnimated: false)
}
}
//--------------------------------------------------
// MARK: - Setup
//--------------------------------------------------

View File

@ -26,9 +26,7 @@ open class Carousel: View {
/// The index of the page, does not include dummy cells.
public var pageIndex: Int {
get {
return loop ? currentIndex - 2 : currentIndex
}
get { return loop ? currentIndex - 2 : currentIndex }
set (newIndex) {
currentIndex = loop ? newIndex + 2 : newIndex
}
@ -90,6 +88,7 @@ open class Carousel: View {
}
}
//--------------------------------------------------
// MARK: - MVMCoreViewProtocol
//--------------------------------------------------
@ -213,9 +212,7 @@ open class Carousel: View {
/// Returns the (identifier, class) of the molecule for the given map.
func getMoleculeInfo(with molecule: MoleculeModelProtocol, delegateObject: MVMCoreUIDelegateObject?) -> (identifier: String, class: AnyClass, molecule: MoleculeModelProtocol)? {
guard let className = MoleculeObjectMapping.shared()?.getMoleculeClass(molecule) else {
return nil
}
guard let className = MoleculeObjectMapping.shared()?.getMoleculeClass(molecule) else { return nil }
return (className.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName, className, molecule)
}