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 6713823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:25:30+00:00 2026-05-26T08:25:30+00:00

I am doing a children’s book using Leaves. I want to have a different

  • 0

I am doing a children’s book using Leaves. I want to have a different animated image and sound play for each page. I have figured out how to do the animation, I have it in a method that i can pass all the animation objects for each page. But each page is so different that I am ending up writing a different method for each page. I have a pageNum var that I want to call each pages method page 5 animation method would be -(void)animatePage5, and so on.

But I can not figure out how to build the method call so that it has the pageNum object in it.

I know this is easy, but I just can not find an answer on google, or stack overflow.

I might be too close to the forest to see the trees.

What is the simple, best practice for this type of method call.

Thanks for helping out a noob….

  • 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-05-26T08:25:31+00:00Added an answer on May 26, 2026 at 8:25 am

    You could use a switch statement to redirect the method call to the right method:

    -(void)animagePage:(int)pagenum
    {
        switch (pagenum) {
            case 1: [self animatePage1]; break;
            case 2: [self animatePage2]; break;
            case 3: [self animatePage3]; break;
            ...
            case 25: [self animatePage25]; break;
        }
    }
    

    Or you can create a string and then convert it to a @selector:

    NSString* methodName = [NSString stringWithFormat:@"animatePage%d", pagenum];
    SEL aSelector = NSSelectorFromString( methodName );
    [self performSelector:aSelector];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page which loads children pages by using jQuery's .load function... My
I have a hashmap that contains 10 children hashmap, each of these child hashmap
I am getting the index of a row by doing this: row.parent().children(tr).index(row) Is there
I tried doing var div = document.createElement('div'); var nodeList = new query.NodeList(); nodeList.push(div); nodeList.children(.someClass);
Doing some ETL and I have a wide file with lots of cols, for
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing some jquery animation. I have certain divs set up with an attribute of
I am doing some very basic tests to see if using parallel processing in
We have a canvas that has a Children collection with an indexer. We have
I'm doing a Surface Application. And there I have something like a bulletin board

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.