UIButton drop down animation

Discussion in 'iOS Programming' started by nashyo, Jan 23, 2012.

  1. nashyo macrumors 6502

    nashyo

    Joined:
    Oct 1, 2010
    Location:
    Bristol
    #1
    Hello MacRumors

    How can I get this animation with a UIButton in my app? (see image)

    http://imageshack.us/photo/my-images/853/img0232l.png/

    I want to present text in a drop down like effect, when the button is selected.

    Anyone know how to get this cool effect to work?

    Thanks
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    You could use a UITableView and animate a row getting added with the text when the button cell is tapped.

    Or you could figure out how to use animation blocks... the iOS programming course available through Stanford's iTunes U page has a pretty good intro lecture on animation blocks for free.
     
  3. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #3
    Are you talking about animating "controls the cells activities" from under the "nucleus" button?

    What came to my mind is that you place the button on top of the view to be animated. When you press the button, you use the built-in animation system to push down that background view, there by unhiding it. You'll also have to push down the content below that. You may also have to control the bounds and clipping explicitly so the background view doesn't show when hidden. It looks to me that it is taller than the button in this sample.

    You would want the background animation and the lower content animation to occur at the same time. To do that you would group the animations.

    To manage pushing down the lower content, you might want to use tags and apply the animation to tags greater than the current button you are pushing.

    To make it easier perhaps, placing the button and the background view onto their own backing view might be advisable. My thought here is that the it would make it easier to push down content below the button you are acting upon because you would push their backing views. Therefore, if one or more of them have already revealed there background wording, you'll move the group rather than managing each button and background wording.

    Think in layers; What is always in the foreground? What is underneath that, etc. This helps break down the problem.

    Those are some quick thoughts on this.
     

Share This Page