How can I vertical-center a UIImageView in super view with the snapkit? I tried like this:
imageview.snp.makeConstraints { (make) in
make.centerY.equalTo(view.center.y);
}
but seems not well.How can I use the snapkit
Try following code
Imageview.snp.makeConstraints { (make) in
make.left.equalTo(view.snp.left).offset(50)
make.centerY.equalTo(self.view)
make.width.height.equalTo(100)
}
It's not enough to give the imageView a centerY only , you need to give it also width,height and x constraint , so try this
imageview.snp.makeConstraints { (make) in
make.left.equalTo(view.snp.left).offset(50)
make.centerY.equalTo(self.view)
make.width.height.equalTo(100)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With