Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

PriapusZA

macrumors 6502a
Original poster
Oct 21, 2011
677
1
England
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!
 
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
 
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

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?
 
Last edited:
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
 
You should check out Ray Wenderlich's scroll view tutorial. It will show you how to implement something similar to what you described.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.