最喜欢的 我有一个图像视图来显示相机的结果,但是问题是当我拍摄照片时,结果是图像将被缩放。
这是我的代码:
var userData2 = userData()
var base64String1: String!
var decodedData1: Data!
var decodedImage1: UIImage!
@IBOutlet weak var imageResult: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
base64String1 = userData2.fotoIDString!
decodedData1 = Data(base64Encoded: base64String1, options: [])!
decodedImage1 = UIImage(data: decodedData1)!
// decodedImage1 = Toucan(image: decodedImage1).resize(CGSize(width: 100, height: 150)).maskWithEllipse().image
imageResult.image = decodedImage1
imageResult.transform = CGAffineTransform(rotationAngle: CGFloat.pi/2)
imageResult.contentMode = .scaleAspectFill
}
答案 0 :(得分:0)
imageResult.contentMode = .scaleAspectFill
尝试AspectFit *