0

I have two views in a single XIB and I want to be able to swipe between them. I've looked at other tutorials but the swipe isn't right. I want the swipe to be the kind of swipe you get on the Photos app. For example, the views appear from the direction of the swipe, able to hold it in the middle and let it snap to the closest view, etc.

I am not using storyboards.

memmons
  • 40,222
  • 21
  • 149
  • 183
user2397282
  • 3,798
  • 15
  • 48
  • 94

2 Answers2

1

You can use a UIScrollView which contains the ViewControllers: Have a look at this post: How do I put viewController's into a UIScrollView

Community
  • 1
  • 1
mhaddl
  • 885
  • 1
  • 9
  • 18
  • I have tried using that method and I'm not finding it too easy. I also realise that I was not 100% correct in my question. I have only one viewcontroller.xib, with two separate views. How can I get the scrollview to work between them? – user2397282 Aug 04 '13 at 17:30
0

What you are looking for is a stacked view controller -- similar to the Facebook app. There are plenty of frameworks out there to do this. Here are a couple of good examples:

https://github.com/steipete/PSStackedView PSStackedView

https://github.com/raweng/stack-scroll-view enter image description here

memmons
  • 40,222
  • 21
  • 149
  • 183
  • 1
    @Rob Yes. See his comment in another answer -- " I also realise that I was not 100% correct in my question. I have only one viewcontroller.xib, with two separate views. How can I get the scrollview to work between them" – memmons Aug 04 '13 at 20:02
  • I should clarify that I am really new to Objective-C and very inexperienced. In my app, I have a single .xib file. It started with a single view, and I dragged another one from the object library next to it. I don't know whether I'm doing this right, but I want to be able to swipe between those views, just like you swipe between two photos. I'm afraid the stacked view controller you've suggested doesn't look like the thing i want. – user2397282 Aug 04 '13 at 20:06