implemented feedback
This commit is contained in:
parent
bd4450a7fc
commit
73230fa341
@ -13,7 +13,7 @@ open class Carousel: View {
|
|||||||
public let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: MVMCoreUISplitViewController.getDetailViewWidth(), height: 300), collectionViewLayout: UICollectionViewFlowLayout())
|
public let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: MVMCoreUISplitViewController.getDetailViewWidth(), height: 300), collectionViewLayout: UICollectionViewFlowLayout())
|
||||||
|
|
||||||
/// The current index of the collection view. Includes dummy cells when looping.
|
/// The current index of the collection view. Includes dummy cells when looping.
|
||||||
var currentIndex = 0
|
public var currentIndex = 0
|
||||||
|
|
||||||
/// The index of the page, does not include dummy cells.
|
/// The index of the page, does not include dummy cells.
|
||||||
public var pageIndex: Int {
|
public var pageIndex: Int {
|
||||||
@ -114,7 +114,6 @@ open class Carousel: View {
|
|||||||
layout.scrollDirection = .horizontal
|
layout.scrollDirection = .horizontal
|
||||||
layout.minimumLineSpacing = CGFloat(carouselModel?.spacing ?? 1)
|
layout.minimumLineSpacing = CGFloat(carouselModel?.spacing ?? 1)
|
||||||
layout.minimumInteritemSpacing = 0
|
layout.minimumInteritemSpacing = 0
|
||||||
layout.itemSize = CGSize(width: MVMCoreUISplitViewController.getDetailViewWidth(), height: 300)
|
|
||||||
collectionView.collectionViewLayout = layout
|
collectionView.collectionViewLayout = layout
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,19 +183,19 @@ open class Carousel: View {
|
|||||||
pagingView?.removeFromSuperview()
|
pagingView?.removeFromSuperview()
|
||||||
guard let pagingView = view else {
|
guard let pagingView = view else {
|
||||||
bottomPin?.isActive = false
|
bottomPin?.isActive = false
|
||||||
bottomPin = bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
|
bottomPin = safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
|
||||||
bottomPin?.isActive = true
|
bottomPin?.isActive = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pagingView.translatesAutoresizingMaskIntoConstraints = false
|
pagingView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
addSubview(pagingView)
|
addSubview(pagingView)
|
||||||
pagingView.centerXAnchor.constraint(equalTo: collectionView.centerXAnchor).isActive = true
|
pagingView.centerXAnchor.constraint(equalTo: collectionView.centerXAnchor).isActive = true
|
||||||
collectionView.bottomAnchor.constraint(equalTo: pagingView.topAnchor, constant: position).isActive = true
|
collectionView.bottomAnchor.constraint(equalTo: pagingView.bottomAnchor, constant: position).isActive = true
|
||||||
bottomAnchor.constraint(greaterThanOrEqualTo: pagingView.bottomAnchor).isActive = true
|
safeAreaLayoutGuide.bottomAnchor.constraint(greaterThanOrEqualTo: pagingView.bottomAnchor).isActive = true
|
||||||
bottomPin?.isActive = false
|
bottomPin?.isActive = false
|
||||||
bottomPin = bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
|
bottomPin = safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
|
||||||
bottomPin?.priority = .defaultLow
|
bottomPin?.priority = .defaultLow
|
||||||
bottomPin?.isActive = false
|
bottomPin?.isActive = true
|
||||||
|
|
||||||
pagingView.setNumberOfPages(numberOfPages)
|
pagingView.setNumberOfPages(numberOfPages)
|
||||||
(pagingView as? MVMCoreUIViewConstrainingProtocol)?.alignHorizontal?(.fill)
|
(pagingView as? MVMCoreUIViewConstrainingProtocol)?.alignHorizontal?(.fill)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user