- Has 1 button named "Click me!".
- Has 1 empty label.
When the "Click me!" button is pressed, the empty label should randomly show 1 message out of a list with 20 messages.
How can this be done?
And is it possible to make the user be able to click the button only twice pr. day? So that the user can only view 2 messages pr. 24 hours?
Didn`t know whether I should post this here or in the Tutorial Request, but I took a chance .
Just found out another way to do this.
With NSArray you can make a list with several phrases and have them "randomly" printed to a label.
How do I do this?
Just found out another way to do this.
With NSArray you can make a list with several phrases and have them "randomly" printed to a label.
How do I do this?
Well, I am assuming you want it to show more then the phrase and have an action occur accordingly with the label (like I just did) - in which case you would want each action to be defined seperately and just include the label text change. Even if you don't want to NOW, I think this may be a better way because as you excel more you may want to include actions with this randomicity.
Well, I am assuming you want it to show more then the phrase and have an action occur accordingly with the label (like I just did) - in which case you would want each action to be defined seperately and just include the label text change. Even if you don't want to NOW, I think this may be a better way because as you excel more you may want to include actions with this randomicity.
"Are you sure you added the 3 actions into the header?":
What do you mean by that?
well, in the [header] .h file (under classes), make sure you have the 3 actions that i wrote in the original response to go into the [header] .h. I do not believe that is the problem after looking at your code though, it looks like you miscopied some of what i wrote: i.e. you wrote mylabel:@"phrasea" and mylabel:@"phraseb" instead of mylabel = @"phrasea" and mylabel = @"phrase b". that should now work if you hook up the randomaction to the button.
Haha, thanks to you both!
And Rywola, without your post I would never be able to make this! ˆˆ,
yeah, no problem. keep in mind you can add any actions to those two phrase threads to get a little more advanced or add more actions/labels if you follow the 'pattern'