Merge branch 'develop' into 'feature/develop_mvp_3'
Develop See merge request BPHV_MIPS/mvm_core_ui!806
This commit is contained in:
commit
19b7f53fcd
@ -23,7 +23,7 @@ import UIKit
|
|||||||
var additionalData: [AnyHashable: Any]?
|
var additionalData: [AnyHashable: Any]?
|
||||||
|
|
||||||
let layout = UICollectionViewFlowLayout()
|
let layout = UICollectionViewFlowLayout()
|
||||||
public var collectionView: UICollectionView?
|
public var collectionView: CollectionView?
|
||||||
|
|
||||||
let bottomScrollView = UIScrollView(frame: .zero)
|
let bottomScrollView = UIScrollView(frame: .zero)
|
||||||
let bottomContentView = View()
|
let bottomContentView = View()
|
||||||
@ -61,6 +61,7 @@ import UIKit
|
|||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
|
collectionView?.updateView(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
@ -76,7 +77,7 @@ import UIKit
|
|||||||
layout.scrollDirection = .horizontal
|
layout.scrollDirection = .horizontal
|
||||||
layout.minimumLineSpacing = 0
|
layout.minimumLineSpacing = 0
|
||||||
|
|
||||||
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
|
let collectionView = CollectionView(frame: .zero, collectionViewLayout: layout)
|
||||||
collectionView.translatesAutoresizingMaskIntoConstraints = false
|
collectionView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
collectionView.register(TabItemCell.self, forCellWithReuseIdentifier: TabCellId)
|
collectionView.register(TabItemCell.self, forCellWithReuseIdentifier: TabCellId)
|
||||||
collectionView.backgroundColor = .clear
|
collectionView.backgroundColor = .clear
|
||||||
@ -172,6 +173,7 @@ extension Tabs: UICollectionViewDataSource {
|
|||||||
return UICollectionViewCell()
|
return UICollectionViewCell()
|
||||||
}
|
}
|
||||||
cell.updateCell(labelModel: labelModel, indexPath: indexPath, delegateObject: delegateObject, additionalData: additionalData, selected: indexPath.row == selectedIndex, tabsModel: tabsModel)
|
cell.updateCell(labelModel: labelModel, indexPath: indexPath, delegateObject: delegateObject, additionalData: additionalData, selected: indexPath.row == selectedIndex, tabsModel: tabsModel)
|
||||||
|
updateView(collectionView.bounds.width)
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,7 +319,6 @@ extension Tabs {
|
|||||||
|
|
||||||
@objcMembers public class TabItemCell: CollectionViewCell {
|
@objcMembers public class TabItemCell: CollectionViewCell {
|
||||||
public let label = Label()
|
public let label = Label()
|
||||||
public var labelModel: LabelModel?
|
|
||||||
|
|
||||||
public override func setupView() {
|
public override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
@ -326,10 +327,14 @@ extension Tabs {
|
|||||||
label.baselineAdjustment = .alignCenters
|
label.baselineAdjustment = .alignCenters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
label.updateView(size)
|
||||||
|
}
|
||||||
|
|
||||||
public func updateCell(labelModel: LabelModel, indexPath: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, selected: Bool, tabsModel: TabsModel?) {
|
public func updateCell(labelModel: LabelModel, indexPath: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, selected: Bool, tabsModel: TabsModel?) {
|
||||||
label.reset()
|
label.reset()
|
||||||
label.set(with: labelModel, delegateObject, additionalData)
|
label.set(with: labelModel, delegateObject, additionalData)
|
||||||
self.labelModel = labelModel
|
|
||||||
if selected {
|
if selected {
|
||||||
label.textColor = tabsModel?.selectedColor.uiColor ?? .black
|
label.textColor = tabsModel?.selectedColor.uiColor ?? .black
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -54,8 +54,8 @@ public class TabsModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
|
|
||||||
public class TabItemModel: Codable {
|
public class TabItemModel: Codable {
|
||||||
var label: LabelModel
|
public var label: LabelModel
|
||||||
var action: ActionModelProtocol?
|
public var action: ActionModelProtocol?
|
||||||
|
|
||||||
init(label: LabelModel) {
|
init(label: LabelModel) {
|
||||||
self.label = label
|
self.label = label
|
||||||
|
|||||||
@ -17,6 +17,15 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol,
|
|||||||
/// A list of cached controllers.
|
/// A list of cached controllers.
|
||||||
private var viewControllers: [UIViewController?]
|
private var viewControllers: [UIViewController?]
|
||||||
|
|
||||||
|
/// Used to layout the ui.
|
||||||
|
public lazy var stackView: UIStackView = {
|
||||||
|
let stackView = UIStackView(arrangedSubviews: [tabs, line, subNavigationController.view])
|
||||||
|
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
stackView.isAccessibilityElement = false
|
||||||
|
stackView.axis = .vertical
|
||||||
|
return stackView
|
||||||
|
}()
|
||||||
|
|
||||||
private var tabsModel: TabsModel
|
private var tabsModel: TabsModel
|
||||||
public lazy var tabs: Tabs = {
|
public lazy var tabs: Tabs = {
|
||||||
let tabs = Tabs(model: tabsModel, delegateObjectIVar, nil)
|
let tabs = Tabs(model: tabsModel, delegateObjectIVar, nil)
|
||||||
@ -80,23 +89,15 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol,
|
|||||||
let view = View()
|
let view = View()
|
||||||
view.translatesAutoresizingMaskIntoConstraints = true
|
view.translatesAutoresizingMaskIntoConstraints = true
|
||||||
|
|
||||||
view.addSubview(tabs)
|
|
||||||
view.addSubview(line)
|
|
||||||
addChild(subNavigationController)
|
addChild(subNavigationController)
|
||||||
view.addSubview(subNavigationController.view)
|
view.addSubview(stackView)
|
||||||
subNavigationController.didMove(toParent: self)
|
subNavigationController.didMove(toParent: self)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
tabs.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
stackView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||||
view.trailingAnchor.constraint(equalTo: tabs.trailingAnchor),
|
view.trailingAnchor.constraint(equalTo: stackView.trailingAnchor),
|
||||||
line.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
stackView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
|
||||||
view.trailingAnchor.constraint(equalTo: line.trailingAnchor),
|
view.bottomAnchor.constraint(equalTo: stackView.bottomAnchor)
|
||||||
subNavigationController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
|
||||||
view.trailingAnchor.constraint(equalTo: subNavigationController.view.trailingAnchor),
|
|
||||||
tabs.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
|
|
||||||
line.topAnchor.constraint(equalTo: tabs.bottomAnchor),
|
|
||||||
subNavigationController.view.topAnchor.constraint(equalTo: line.bottomAnchor),
|
|
||||||
view.bottomAnchor.constraint(equalTo: subNavigationController.view.bottomAnchor)
|
|
||||||
])
|
])
|
||||||
self.view = view
|
self.view = view
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// The navigation controller that the tabbarpagecontrol uses for the children controllers. It always has the navigation bar hidden.
|
/// The navigation controller that the SubNavManager uses for the children controllers. It always has the navigation bar hidden.
|
||||||
@objc public class SubNavManagerNavigationController: UINavigationController {
|
@objc public class SubNavManagerNavigationController: UINavigationController {
|
||||||
|
|
||||||
public override init(rootViewController: UIViewController) {
|
public override init(rootViewController: UIViewController) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user