Note that there are some explanatory texts on larger screens.

plurals
  1. PORandomly call a method
    primarykey
    data
    text
    <p>I have 7 methods in a class. When i receive a specific message i have to call a method randomly from those 7 methods. My sample code is:</p> <pre><code>-(void)poemAbcd{ UIImage *image = [UIImage imageNamed: @"abcd_bg.png"]; [backgroundImage setImage:image]; [self changeMumuPosition:80 with:220]; } -(void)poemHumptyDumpty{ UIImage *image = [UIImage imageNamed: @"humpty_dumpty.png"]; [backgroundImage setImage:image]; [self changeMumuPosition:80 with:170]; } -(void)poemBlackship{ UIImage *image = [UIImage imageNamed: @"black_sheep.png"]; [backgroundImage setImage:image]; [self changeMumuPosition:66 with:229]; } -(void)poemRowRow{ UIImage *image = [UIImage imageNamed: @"boat_bg.png"]; [backgroundImage setImage:image]; [self changeMumuPosition:144 with:211]; } -(void)poemHappy{ UIImage *image = [UIImage imageNamed: @"boat_bg.png"]; [backgroundImage setImage:image]; [self changeMumuPosition:144 with:211]; } -(void)poemItsyBitsy{ UIImage *image = [UIImage imageNamed: @"boat_bg.png"]; [backgroundImage setImage:image]; [self changeMumuPosition:144 with:211]; } -(void)poemTwinkleTwinkle{ UIImage *image = [UIImage imageNamed: @"twincle_twincle_little_star.png"]; [backgroundImage setImage:image]; [self changeMumuPosition:70 with:222]; } </code></pre> <p>Into the following method I want to call a method randomly from those 7 methods.</p> <pre><code>-(void)poemRandom{ //Call a method randomly from those 7 methods } </code></pre> <p>How can i do so? Thanks in advance for the help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload