Auto resize TileView.digitLabel with adjustsFontSizeToFitWidth
This commit is contained in:
parent
04716937eb
commit
4e619b04f0
|
@ -69,6 +69,9 @@ class ViewController: UIViewController, SplitflapDataSource, SplitflapDelegate {
|
||||||
builder.textAlignment = .center
|
builder.textAlignment = .center
|
||||||
builder.textColor = .white
|
builder.textColor = .white
|
||||||
builder.lineColor = .darkGray
|
builder.lineColor = .darkGray
|
||||||
|
|
||||||
|
//Prefilled with false value, so could be ignored 👇
|
||||||
|
builder.adjustsFontSizeToFitWidth = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,14 @@ public final class FlapViewBuilder {
|
||||||
id 1.0.
|
id 1.0.
|
||||||
*/
|
*/
|
||||||
public var flipPointHeightFactor: CGFloat = 1.0
|
public var flipPointHeightFactor: CGFloat = 1.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
The on/off toggle for a label's property "adjustsFontSizeToFitWidth" inside every flap
|
||||||
|
|
||||||
|
By defaul the value is false, but it could be changed while initing a builder
|
||||||
|
*/
|
||||||
|
public var adjustsFontSizeToFitWidth: Bool = false
|
||||||
|
|
||||||
// MARK: - Initializing a Flap View
|
// MARK: - Initializing a Flap View
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -98,6 +98,7 @@ final class TileView: UIView {
|
||||||
digitLabel.textAlignment = builder.textAlignment
|
digitLabel.textAlignment = builder.textAlignment
|
||||||
digitLabel.textColor = builder.textColor
|
digitLabel.textColor = builder.textColor
|
||||||
digitLabel.backgroundColor = builder.backgroundColor
|
digitLabel.backgroundColor = builder.backgroundColor
|
||||||
|
digitLabel.adjustsFontSizeToFitWidth = builder.adjustsFontSizeToFitWidth
|
||||||
flipPointHeightFactor = builder.flipPointHeightFactor
|
flipPointHeightFactor = builder.flipPointHeightFactor
|
||||||
|
|
||||||
addSubview(digitLabel)
|
addSubview(digitLabel)
|
||||||
|
|
Loading…
Reference in New Issue