Merge branch 'feature/tilet' into 'develop'
helper method for setNeedsLayout() See merge request BPHV_MIPS/vds_ios!40
This commit is contained in:
commit
5533eeda9c
@ -270,9 +270,10 @@ open class Tilelet: TileContainer {
|
||||
badge.maxWidth = badgeModel.maxWidth
|
||||
if badgeContainerView.superview == nil {
|
||||
stackView.insertArrangedSubview(badgeContainerView, at: 0)
|
||||
setNeedsLayout()
|
||||
}
|
||||
} else {
|
||||
badgeContainerView.removeFromSuperview()
|
||||
removeFromSuperview(badgeContainerView)
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,9 +327,10 @@ open class Tilelet: TileContainer {
|
||||
|
||||
if titleLockupContainerView.superview == nil {
|
||||
stackView.insertArrangedSubview(titleLockupContainerView, at: badgeContainerView.superview == nil ? 0 : 1)
|
||||
setNeedsLayout()
|
||||
}
|
||||
} else {
|
||||
titleLockupContainerView.removeFromSuperview()
|
||||
removeFromSuperview(titleLockupContainerView)
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,19 +368,21 @@ open class Tilelet: TileContainer {
|
||||
}
|
||||
if iconContainerView.superview == nil {
|
||||
stackView.addArrangedSubview(iconContainerView)
|
||||
setNeedsDisplay()
|
||||
}
|
||||
} else {
|
||||
iconContainerView.removeFromSuperview()
|
||||
removeFromSuperview(iconContainerView)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open override func updateView() {
|
||||
super.updateView()
|
||||
|
||||
|
||||
updateBadge()
|
||||
updateTitleLockup()
|
||||
updateIcons()
|
||||
|
||||
layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,3 +14,11 @@ public protocol ViewProtocol {
|
||||
func setup()
|
||||
}
|
||||
|
||||
extension ViewProtocol where Self: UIView {
|
||||
public func removeFromSuperview(_ view: UIView){
|
||||
if view.superview != nil {
|
||||
view.removeFromSuperview()
|
||||
setNeedsDisplay()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user