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 02-07-2012, 11:19 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2012
Posts: 16
sandromandro is on a distinguished road
Default iPhone SDK develop image falling down animation/ possible to repeat?

hey, i have a question, in my project i have a falling image but it falls only one time. is it possible to repeat the falling image?

my code:
Quote:
- (void)viewDidLoad
{
ObjektTimer = [NSTimer scheduledTimerWithTimeInterval:0.035 target:self selector:@selector(movepicture) userInfo:nil repeats:YES];
[super viewDidLoad];
}

-(void)movepicture{

Menueball3.center = CGPointMake(Menueball3.center.x, Menueball3.center.y +1);
}
please help me
sandromandro is offline   Reply With Quote
Old 02-07-2012, 02:45 PM   #2 (permalink)
Registered Member
 
mouser58907's Avatar
 
Join Date: Feb 2010
Posts: 188
mouser58907 is on a distinguished road
Default

Your move picture function only moves it down. You need to check and once it is off the bottom, reset Menueball3.center.y to where it began.
__________________
My Apps:Pee Prank (free)
My Company: Pulsar Productions

If I helped you, download my App or tell a friend! Thanks.
mouser58907 is offline   Reply With Quote
Old 02-07-2012, 03:17 PM   #3 (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 sandromandro View Post
hey, i have a question, in my project i have a falling image but it falls only one time. is it possible to repeat the falling image?

my code:


please help me
You should really use Core Animation to do this instead of a timer. With Core Animation, you just tell it the position you want to animate to, and it does it for you, more efficiently, and more smoothly, than you could yourself.

Take a look at the UIView class method animateWithDuration:animations:completion: or animateWithDuration:delayptions:animations:compl etion:

If you search on that method name here you should find a number of examples of how to use it. I know if you search on "animateWithDuration" and my name, you'll find quite a few examples I've posted.

The longer form, with an options parameter, takes a list of options, one of which is an auto-repeat setting, (UIViewAnimationOptionRepeat)
__________________
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 02-07-2012, 06:56 PM   #4 (permalink)
Registered Member
 
Join Date: Jan 2012
Location: Illinois
Posts: 44
GHuebner is on a distinguished road
Default

The stanford class has a good introduction to animation in lecture 15. Its still pretty basic but gives a good starting foundation.

iPad and iPhone App Development (Fall 2011) - Download Free Content from Stanford on iTunes



Quote:
Originally Posted by Duncan C View Post
You should really use Core Animation to do this instead of a timer. With Core Animation, you just tell it the position you want to animate to, and it does it for you, more efficiently, and more smoothly, than you could yourself.

Take a look at the UIView class method animateWithDuration:animations:completion: or animateWithDuration:delayptions:animations:compl etion:

If you search on that method name here you should find a number of examples of how to use it. I know if you search on "animateWithDuration" and my name, you'll find quite a few examples I've posted.

The longer form, with an options parameter, takes a list of options, one of which is an auto-repeat setting, (UIViewAnimationOptionRepeat)
GHuebner is offline   Reply With Quote
Reply

Bookmarks

Tags
image animation, repeat

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: 399
13 members and 386 guests
7twenty7, chiataytuday, cristofercolmbos, fiftysixty, gmarro, iOS.Lover, KennyChong, kilobytedump, Matrix23, raymng, ryantcb, stanny, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

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