Reputation: 73
I am having an UIImageView as main view so when the main image tapped i add a subview which is another UIImageView and i would like to set the position of the ImageView of subview. Is there any suggestion?
Upvotes: 0
Views: 1945
Reputation: 364
You have to place your image like this :
let yourSecondImage = UIImageView(frame: CGRect(x: yourMainImage.frame.origin.x + xOffset, y: yourMainImage.frame.origin.y + yOffset, width: yourImageWidth, height: yourImageHeight))
Then use constraints to make your subview dynamically resized
yourMainImage.translatesAutoresizingMaskIntoConstraints = false
Upvotes: 1