AVFoundation框架
//得到图片的高
func getImageHeight(imagev:UIImageView) ->CGSize {
//图片image 在imageview 的位置
let iamgeAspectRect =AVMakeRect(aspectRatio: (imagev.image?.size)!, insideRect: imagev.bounds);
//图片比例
let scale = iamgeAspectRect.size.height/iamgeAspectRect.size.width;
//重置
let hight = (imagev.frame.size.width - iamgeAspectRect.size.width)*scale+iamgeAspectRect.size.height;
returnCGSize(width: imagev.frame.size.width, height: hight)
}