func imageViewSize(image: UIImage) {
let wi = image.size.width / 3.14
let hi = image.size.height / 3.14
shadowView.frame.size.width = wi
shadowView.frame.size.height = hi
shadowView.clipsToBounds = false
shadowView.layer.cornerRadius = 25
shadowView.layer.shadowRadius = 9
shadowView.layer.shadowColor = UIColor.darkGray.cgColor
shadowView.layer.shadowOffset = CGSize(width: 3, height: 3)
shadowView.layer.shadowOpacity = 0.8
imageView.frame = shadowView.bounds
imageView.contentMode = .scaleAspectFit
imageView.layer.masksToBounds = true
imageView.layer.cornerRadius = 25
imageView.image = image
createConstrainsShadowView()
}
let wi = image.size.width / 3.14
let hi = image.size.height / 3.14
shadowView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint(item: shadowView,
attribute: .top,
relatedBy: .greaterThanOrEqual,
toItem: view,
attribute: .topMargin,
multiplier: 1,
constant: 64).isActive = true
NSLayoutConstraint(item: shadowView,
attribute: .bottom,
relatedBy: .lessThanOrEqual,
toItem: svButton,
attribute: .bottomMargin,
multiplier: 1,
constant: -70).isActive = true
NSLayoutConstraint(item: shadowView,
attribute: .centerY,
relatedBy: .equal,
toItem: view,
attribute: .centerY,
multiplier: 1,
constant: -10).isActive = true
imageView.contentMode = .scaleAspectFit
imageView.layer.cornerRadius = 25
imageView.clipsToBounds = true
shadowView.clipsToBounds = false
shadowView.layer.cornerRadius = 25
shadowView.layer.shadowRadius = 6
shadowView.layer.shadowColor = UIColor.darkGray.cgColor
shadowView.layer.shadowOffset = CGSize(width: 3, height: 1)
shadowView.layer.shadowOpacity = 0.7
let wi = image.size.width / 4
let hi = image.size.height / 4
self.imageView.frame.size.width = wi
self.imageView.frame.size.height = hi
self.shadowView.frame.size.width = wi
self.shadowView.frame.size.height = hi
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 18).isActive = true
imageView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -18).isActive = true