Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-21-2011, 01:59 PM   #1 (permalink)
Dictator For Life
 
Join Date: Jul 2011
Posts: 2
azhar.hussain is on a distinguished road
Default Animation In Menu Like Angry Birds or Tiny Wings

I was wondering how to add a scrolling menu to my app like tiny wings or angry birds. In tiny wings, the background moves from right to left and I was wondering how they accomplished that. Thanks in advance.
azhar.hussain is offline   Reply With Quote
Old 07-21-2011, 03:46 PM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by azhar.hussain View Post
I was wondering how to add a scrolling menu to my app like tiny wings or angry birds. In tiny wings, the background moves from right to left and I was wondering how they accomplished that. Thanks in advance.
Take a look at Core Animation. That makes this sort of thing quite easy.

For iOS 4.0 and later, UIView has some class methods like animateWithDuration:animations: that let you specify a code block to execute as an animation.

All you'd have to do is write a block that changes the center property of an image view so that it moves from right to left across the screen. Something like this:


Code:
[UIView animateWithDuration:1.0 
  animations:
  ^{
        myImageView.center = CGPointMake(0, 100);
    }
];
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 07-21-2011, 04:58 PM   #3 (permalink)
Dictator For Life
 
Join Date: Jul 2011
Posts: 2
azhar.hussain is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
Take a look at Core Animation. That makes this sort of thing quite easy.

For iOS 4.0 and later, UIView has some class methods like animateWithDuration:animations: that let you specify a code block to execute as an animation.

All you'd have to do is write a block that changes the center property of an image view so that it moves from right to left across the screen. Something like this:


Code:
[UIView animateWithDuration:1.0 
  animations:
  ^{
        myImageView.center = CGPointMake(0, 100);
    }
];
I don't fully understand how you are implement this. Could you please elaborate, or make a real quick example project? Thanks! I'm usually on stack overflow so I'm kinda new here. Thanks for all the help though!
azhar.hussain is offline   Reply With Quote
Old 07-21-2011, 05:03 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by azhar.hussain View Post
I don't fully understand how you are implement this. Could you please elaborate, or make a real quick example project? Thanks! I'm usually on stack overflow so I'm kinda new here. Thanks for all the help though!
The code I posted is all you need.

Create an image view. Place it in your view controller and set up an outlet.

Calculate the new center position you want to animate the view to. You can modify the code I posted to get the existing center of the view, then add or subtract from the X coordinate of the center, and then set the new center coordinate inside the animation block.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Reply

Bookmarks

Tags
angry birds, ios, iphone sdk, uiimageview, xcode

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 404
16 members and 388 guests
7twenty7, blasterbr, buggen, chiataytuday, Clouds, dre, EvilElf, HemiMG, jeroenkeij, jimmyon122, jonathandeknudt, LEARN2MAKE, n00b, nyoe, pungs, UMAD
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,668
Threads: 94,121
Posts: 402,901
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jonathandeknudt
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:57 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0