1

I'm pretty new to iOS animations, I've been trying to accomplish something that in my head seems very simple but I am not sure what would be the best way to implement such a thing.

Usage

  • User clicks on a tab located on the right side of the app.
  • A small window slides from the side (or below doesn't really matter direction right now)
  • The sliding object is a UIScrollView currently

Here's a small draft so you guys have an idea

http://dl.dropbox.com/u/919254/animations.png

The black is the tab, there are severals below. When clicked, the red one shows up from a particular direction.

My questions are:

  • How could I accomplish an animation like that?
  • Any good tutorials out there you guys can refer me to?

Seeing sample code here wouldn't hurt!

Chris Martin
  • 30,334
  • 10
  • 78
  • 137
MrShoot
  • 843
  • 1
  • 9
  • 21
  • 1
    http://stackoverflow.com/questions/3126833/what-are-block-based-animation-methods-in-iphone-os-4-0/3316009#3316009 comes with an example. You can animate the small window (a view actually) from off-screen, and forget the UIScrollView. – ohho Aug 11 '11 at 15:56
  • Wouldn't animating a view in replace my first view? I need the UIScrollView because it contains several objects, I have a pagination setup – MrShoot Aug 11 '11 at 16:05

1 Answers1

3

In your view did load:

// Hide scrollView off screen (x=320 for iPhone/iPod)
scrollView.frame = CGRectMake(320, 0, scrollView.frame.size.width, scrollView.frame.size.height);
[self.view addSubview: scrollView];

In your method for opening the view:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

// Assuming 0 is the x-coordinate of where you want your view to go
scrollView.frame = CGRectMake(0, 0, scrollView.frame.size.width, scrollView.frame.size.height);

[UIView commitAnimations];

This will animate your scrollView from the right to the left

bdev
  • 2,060
  • 5
  • 24
  • 32