Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mandude

macrumors member
Original poster
ok so i have one round rect button, and when the user taps this button i need one of three labels in the middle of the screen to randomly be chosen to appear and do so. So i make the -(IBAction)buttonPressed; and connect it to the round rect button. Then i write three labels, one saying "Hello" one saying "GoodBye" and the other saying "See you Later" i set the labels check mark to HIDDEN and that how far ive gone. So, in the .M file, where i would type

-(IBAction)buttonPressed {

...............

}

what would i need to type in there to make it so when i tap the button, one of the 3 labels is set to label*.hidden = NO randomly. The second time the user taps the button, I also want it to know to choose randomly out of the other two labels that are still hidden, and so on until all the labels are visible. Think of it like choosing a marble from a bag, when you choose one you can't put it back in the bag, so when you press the button it chooses one of three, the second time one of two, and so forth. Is there a way you can do this with an NSArray? make a list... helloLabel, goodByeLabel, seeYouLaterLabel, all help is appreciated
 
ok so i have one round rect button, and when the user taps this button i need one of three labels in the middle of the screen to randomly be chosen to appear and do so. So i make the -(IBAction)buttonPressed; and connect it to the round rect button. Then i write three labels, one saying "Hello" one saying "GoodBye" and the other saying "See you Later" i set the labels check mark to HIDDEN and that how far ive gone. So, in the .M file, where i would type

-(IBAction)buttonPressed {

...............

}

what would i need to type in there to make it so when i tap the button, one of the 3 labels is set to label*.hidden = NO randomly. The second time the user taps the button, I also want it to know to choose randomly out of the other two labels that are still hidden, and so on until all the labels are visible. Think of it like choosing a marble from a bag, when you choose one you can't put it back in the bag, so when you press the button it chooses one of three, the second time one of two, and so forth. Is there a way you can do this with an NSArray? make a list... helloLabel, goodByeLabel, seeYouLaterLabel, all help is appreciated

you can use NSArray and store the objects there. You can then generate a value and determine the index of the object in the array and display it. Once it is done, you can then remove it from the array. Then the process repeats for the other two.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.