I have an image as 30x30. I want to put this image into center of another 500x500 image and i want to define a background for 500x500 image like the following example. Is there any way to achieve this? Thank you.
Asked
Active
Viewed 5,509 times
1
-
Use AutoLayout and add the 500*500 image first and then add the 30*30 UIImage on top of it with a fixed height and width. – Jay Mayu Sep 21 '18 at 11:48
-
Btw if you could show what you have done so far, people here would be able to help you out. – Jay Mayu Sep 21 '18 at 11:57
3 Answers
3
Set the image as following, just keep in mind that image's background color should be clear.
imageView.image = UIImage(named: "search_image")
imageView.contentMode = .center

Ankit Jayaswal
- 5,549
- 3
- 16
- 36
0
Set width/height fix for the image. Insert into the background view with constraints centerX and centerY.

gmoraleda
- 1,731
- 1
- 17
- 44