Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8882801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:40:02+00:00 2026-06-14T20:40:02+00:00

I’d like to create random images falling from the top of the screen, down

  • 0

I’d like to create random images falling from the top of the screen, down to the bottom where they disappear. So far, I’ve been able to make 1 image fall down, at a fixed spawn point (center), but I’m unsure how to generate many more that spawn at random places on the top (somewhat like a snowfall or rainfall effect).

This is what I have so far:

-(void) viewDidLoad {
    moveObjectTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(moveObject) userInfo:nil repeats:YES]; }


-(void) moveObject {        // + means down and 5 is SPEED
    bird.center = CGPointMake(bird.center.x, bird.center.y +5); }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:40:03+00:00Added an answer on June 14, 2026 at 8:40 pm

    Say suppose you have 10 images in an array, then to select any 10 images at random you would do;

    int randomIndex rand()/RAND_MAX * 10 + 1;

    Then in some method, you could animate it as;

    -(void) moveObject{
       int randomIndex = rand()/RAND_MAX * 10 + 1;
       UIImage *image = [self.myImages objectAtIndex:randomIndex];
       UIImageView *imageView = [[UIImageView alloc] initWithImage: image];
      CGRect mainRect = CGRectMake(view.frame.size.width + image.size.width,view.frame.size.height - image.size.height,image.frame.size.width,image.size.height );
        imageView.frame mainRect;
        [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
            mainRect.frame.size.origin.x = 0;
            mainRect.frame.origin.y = 0;
            imageView.frame =mainRect;
        } completion:nil];
    }
    

    Your NSTimer should trigger this method and then this would select the random image out of your images, here I suppose 10 images that you have in an array. Then this would animate the images from outside the top/right corner to the bottom left corner at the specified time interval as specified with NSTimer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I am currently running into a problem where an element is coming back from
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:
I would like to count the length of a string with PHP. The string
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.