我正在使用 ImageView 和 CollectionView 创建一个图片库。一切正常,但纵向模式图片超出限制。这是为什么?
myPicture = UIImageView(image: myArray[0])
view.addSubview(myPicture)
myPicture.translatesAutoresizingMaskIntoConstraints = false
myPicture.contentMode = .scaleAspectFill
myPicture.topAnchor.constraint(equalTo: tabBar.bottomAnchor, constant: view.bounds.height / 80).isActive = true
myPicture.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0).isActive = true
myPicture.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0).isActive = true
myPicture.bottomAnchor.constraint(equalTo: collectionView.topAnchor, constant: 0).isActive = true