UIImageView in full screen mode

Discussion in 'iOS Programming' started by Tander, May 16, 2014.

  1. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #1
    Hi All,

    I think I am going about this the wrong way so need a little help, please.

    My Goal:


    I have a UIImageView which displays a single image to the user. The view is in a UIView. When the user taps on the image I would like it to go into a full screen mode. Much like the current Facebook and eBay iOS apps do on iPhone.

    Once in this mode, the user can zoom on the image and when done - swipe up / down on the image and it then goes back to the last view.

    Problem

    I am not entirely sure how this is done. On the apps mentioned, there is a new bar that appears at the bottom of the screen - the bar allows the user to do other actions. This, along with the swipe gesture makes me believe this full screen mode is actually presented with a new view controller. I just am not too sure how it is done.

    I tried setting my UIImageView to full screen - but it misses everything else as described above.

    Can anyone point me in the right direction. I'd really appreciate it.

    Thanks!
     
  2. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #2
    You would most likely need to set up a new UIViewController with a UIScrollView as the main content of the viewController.view

    You can then add the UIImageView to the scroll view.

    As for how to dismiss the new view controller when the user swipes down, well you could set up a gesture recognizer and use delegate-protocol methods to tell the base view controller to dismiss the new view controller when the user swipes up/down
     
  3. Tander, May 16, 2014
    Last edited: May 16, 2014

    Tander thread starter macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #3
    Thanks. That actually makes sense. I will give it a try tonight to see how I get on.

    Edit: I noticed in the eBay iOS app - as you swipe down or up on the screen - the background starts to go clear and you can see the view behind it - Is this even possible with a new viewController for the imageView?
     
  4. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #4
    I am not sure. You could experiment with the alpha property of the ViewController's view property like so:

    Code:
    - (void)viewDidLoad {
         [super viewDidLoad];
         self.view.opaque = YES;
         self.view.backgroundColor = [UIColor clearColor];
    }
    Note: copied from this StackOverflow thread from a quick google, so please verify for yourself by checking out that thread
     
  5. TheWatchfulOne macrumors 6502

    Joined:
    Jun 19, 2009
    #5
    You should check out Ray Wenderlich's scroll view tutorial. It will show you how to implement something similar to what you described.
     
  6. Tander thread starter macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #6
    Thanks gents. I have found the solution for the UIViewController background showing the presenting view controller - by taking a snapshot of the presenting view controller and just before i dismiss set it as background image for the full screen image view controller. Will play around with it all for a bit.
     

Share This Page