Pop up VC's that share different labels as a source...?

Looking for a way to tackle this:

  1. I’ve got a bunch of labels with some values (Int’s) in them.
  2. Each label value will go off and produce two figures for display.
  3. When a label is touched, the window will contain some text and the two figures.
  4. this pop up need only be centered in the screen (x and y is fine)
  5. tapping outside or a small “x” will close the window.


  1. are these different VCs for each label or just one new VC, populated by each label?

  2. is there a good tutorial for this sort of thing?

  3. I’m imaging a function that does the math for the two figures I need ,and it gets called and passed to by the individual labels?

As always, thanks for the patience.

OK so to paraphrase what you have said above - you want to tap on a label and the have that trigger a calculation using that value which will then popup a View which will contain some text and two values that are generated from that calculation. Is that about right?

To dismiss the popup you want to either trigger that by tapping outside that popup boundary or tap a small “x” inside the popup (effectively a button I presume).

Q1: This popup can be considered as a Detail View which can be generic and have the text and the two values passed to it after the function (referred to in Q3) has completed the calculation. So you could have a label for the text and configure that for multiple lines and then 2 labels for the values generated from the function you refer to in Q3.

Maybe it could look something like this:

It could be presented modally (slide up from the bottom) and the background of the Popup could be Black with an initial opacity of 0 which could be animated to 0.5 so that the calling VC would be partially obscured to accentuate the sense of it being a popup.

I see where you went. Thank you for detailing your response.

I’m testing all this in a separate project. I made a 3rd VC with a small view in the middle that contains labels, outputs, and a close button.

I was stuck on getting a label to respond to the tap gesture—realized the interaction box was not checked.

There are 20 labels that would need to be tapped to produce this little output device. I’m suspecting I can connect this gesture to all labels that need it?


haha, I got the background to default to only show the data window. I dragged the close button back to the other view controller to “slide back” but after it goes back, attempting to close THAT VC just goes back to the popup window.

It looks like this worked as an action on the close button. Changed the animated to true and it transitions smoothly . Now to tie all the labels together.

@IBAction func closePopUp(_ sender: UIButton) {

** self.dismiss(animated: false, completion: nil)**

** }**