Xcode how to add buttons to an image view

What approach would I take to add buttons to an image in xcode? The app is for iPhones and iPads so it needs to be "responsive" somehow. I am trying to do something like this image has sample image map I found a Github project that uses Obj-C, but I am just trying to learn app development and have no idea what I am doing. Eventually, once the button is pressed I will make some kind of popup with an image and a little info. My app is in swift. I would appreciate and tips or direction to tutorials.


In InterfaceBuilder, you create an ImageView, with the image you want:

- connect to an IBOutlet in the viewController

@IBOutlet var myImage: UIImageView!


- add a png image to your project (called SampleImage.png for instance)

- in viewDidLoad, load the image :

myImage.image = UIImage(named: "SampleImage")

You could also define the image name in the inspection panel of the imageView (attributes inspector)


Then create the buttons

- in IB, add a button on top of the imageView

- create IBOutlet for the butto,

- connect the button from IB to its IBOutlet

- define the actions of each button: control drag from the button to inside the class definbing the viewController and select action

- add the content of the action : to start , just put

print("I pushed the button")

Xcode how to add buttons to an image view
 
 
Q