I've created the image view and set the image dynamically based on the API response. I've set the image and constraints programmatically and didn't use any storyboard files. Currently I am setting the content mode of the image view. Now I want to set the ratio value to 21:9 to the image programmatically. Is that possible to give the ratio value to the image?
Thanks in Advance!
你可以使用:
imageView.heightAnchor.constraint(equalTo: imageView.widthAnchor, multiplier: 21/9).isActive = true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.