ScaleAspectFit ScaleAspectFill
0000_0000_0000_0010.ScaleToFill、ScaleAspectFit、ScaleAspectFill – Meadows of Heaven – 博客频道 – CSDN.NET
解释的不错。
我此处暂时用:
override func viewDidLoad() { super.viewDidLoad() self.title = bubbleImageView.resMsg.fileItem.name self.imageView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] self.imageView.contentMode = .ScaleAspectFit self.view.addSubview(self.imageView) constrain(imageView) {imageView in //imageView.edges <= imageView.superview!.edges imageView.left == imageView.superview!.left imageView.top == imageView.superview!.top imageView.right == imageView.superview!.right imageView.bottom == imageView.superview!.bottom } } |
效果: