Kiwo Tew
Kiwo Tew

Reputation: 1531

swift show images in full screen from embedded page view controller

I have an embedded Page View Controller inside my VC.

What is the best solution to add a tap gesture on the image, so that it will open in a full screen with zoom enabled / paging between the images?

Should I try to animate this in my current VC or should I open it inside another VC?

Thanks in advance,

Upvotes: 0

Views: 563

Answers (1)

random
random

Reputation: 8608

I would animate the page view controller to fill the screen instead of adding a new UIViewController, here is why:

  1. Memory: You already have the images loaded once, no need to create a new UIViewController and re-load again. Also adding another UIViewController to the stack isn't the end of the world but should be avoided if possible.
  2. Code: You'v already written code to handle the content size and addition of images to the page controller. Copy and pasting into a new UIViewController would be extremely redundant.
  3. Animation: If you wanted to animate the photo going to full screen the best way would be to animate the frame of the existing page controller. Just make sure to update the content size after animating.

Upvotes: 1

Related Questions