-
Notifications
You must be signed in to change notification settings - Fork 236
Closed
Description
Code:
import FlexLayout
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
view.addSubview(MyView())
}
}
class MyView: UIView {
override init(frame: CGRect) {
super.init(frame: .zero)
flex.direction(.row).height(30).backgroundColor(.black).wrap(.wrap).alignItems(.center)
.addItem().define { flex in
flex.height(15)
.width(20)
.backgroundColor(.red)
}
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func layout() {
self.frame = .init(x: 0, y: 100, width: 200, height: 0)
self.flex.layout(mode: .adjustHeight)
}
override func layoutSubviews() {
self.layout()
}
}
In CSS, flex wrap with align-items works properly:

Metadata
Metadata
Assignees
Labels
No labels