ios - how to make UIView with equal width and height with SnapKit in Swift? -
i want make uiview rectangular snapkit in swift, this
lazy var customview: uiview = { let view = uiview(frame: cgrect()) self.addsubview(view) view.snp.makeconstraints({ (make) in make.left.top.bottom.equaltosuperview().inset(self.inset) make.width.equalto(make.height) // error in line }) return view }()
you have use view.mas_height
instead of make.height
:
lazy var customview: uiview = { let view = uiview(frame: cgrect()) self.addsubview(view) view.snp.makeconstraints({ (make) in make.left.top.bottom.equaltosuperview().inset(self.inset) make.width.equalto(view.mas_height) // <--- }) return view }()
Comments
Post a Comment