Nested view over a background with horizontal and vertical swiping in UIKit

Discussion in 'iOS Programming' started by iRCL, Dec 13, 2011.

  1. iRCL macrumors 6502

    Nov 2, 2011
    I have:

    -A UIView displaying a (background) image
    - A UIView subclass UIContentView displaying text and stuff (my content)

    I want:

    - The background image to always persist and to define the 'overall' size of what I'm describing here
    - On an 'external' trigger (assume a button press, happens elsewhere) my software calls a method like - (void)addNewContentView:(UIContentView)aContentView;
    - I want this to make the new UIContentView's width to be 90% of the Background view's, height to be 95% of the Background view's
    - I want this new UIContentView to come into view from the bottom of the background view, centered horizontally, and slide up until it is centered horizontally
    - On a second ..addNewContentView: I want the first one to move up and offscreen, pause briefly, and have the new one then come up from the bottom of the background view.

    Further functionality I need is to then display a vertical display of 'dots' indicating how many pages I've displayed, and allow 2 finger swipe to 'go back' and 'go forward' between these pages in a history type of fashion. However, I think with an answer to the above I can work all that out.
  2. ArtOfWarfare macrumors G3


    Nov 26, 2007
    Which part is giving you difficulties? What code have you written so far to try and make this work?

    I suggest making the view appear off the bottom of the screen then using some of UIView's animation block methods to make it slide up to where you want it.
  3. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    I would suggest strongly considering a horizontal-swiping approach, since support for this is built-in. Check out the UIPageViewController as well as the PageControl sample app.
  4. iRCL thread starter macrumors 6502

    Nov 2, 2011

    The part I've got so far is having the background view (that's easy) and also this content view. As of right now the content view renders my content correctly and it already has a horizontal swiping feature that pages through it. So, horizontal is already being used and is already implemented. I use the built in method (don't have it handy) for replacing what's in a view and it's not what I want for the vertical and may not be what I want longterm for the horizontal either, but I'm not worried about that. But, this is why I need the other to be vertical.

    ArtOfWarfare: Can you be a little bit more specific as to which methods I should be using? I'm not terribly familiar with animation or with where to look for more info on that
  5. ArtOfWarfare macrumors G3


    Nov 26, 2007
    I figured you didn't know so I gave you some keywords to start searching for.

    In any event, if you go to iTunes U, Stanford has a great class available for free called iOS Development or something like that. One of the lectures is on animations. I'd suggest watching that to learn how to make your own animations in iOS.

Share This Page