2017-06-10 67 views

回答

0

當初始化UIImageView你可以設置框,在其中定義xy

let anotherImageView = UIImageView(frame: CGRect(x: 10, y: 10, width: 40, height: 40)) 
0

你必須把你的形象是這樣的:

let yourSecondImage = UIImageView(frame: CGRect(x: yourMainImage.frame.origin.x + xOffset, y: yourMainImage.frame.origin.y + yOffset, width: yourImageWidth, height: yourImageHeight)) 

然後使用約束來使您的子視圖動態調整大小

yourMainImage.translatesAutoresizingMaskIntoConstraints = false