设置UIImageView的layer层的一个属性就可以做到 imageView.layer.contentsGravity = kCAGravityResizeAspectFill; 这个属性是按照图片中间区域填充到视图中。