Hey guys, I'm sorry if this is a repost, or if there is a solution already on here. I looked and couldn't find anything that worked for my program.
Here's my problem:
I have a C Array of strings that I'm working with. (if I need this to be NSArray then I know how to do that already). What part of my program does is at a button click, a randomly generated word from the string array appears in a label. This part works fine. The problem is that I cannot figure out how to add the next new word to the label without deleting the first one.
I have already tried 'stringByAppendingFormat' and SEVERAL others. No luck.. =(
Thank you for any help you can offer!
- Steven French
Here's my problem:
I have a C Array of strings that I'm working with. (if I need this to be NSArray then I know how to do that already). What part of my program does is at a button click, a randomly generated word from the string array appears in a label. This part works fine. The problem is that I cannot figure out how to add the next new word to the label without deleting the first one.
Code:
- (IBAction)genWord:(id)sender
{
char *list[] = {"one", "two", "three", "four", "five"};
int listLength = (sizeof list) / (sizeof list[0]);
listLength = random() % listLength;
[oneWord setStringValue:[NSString stringWithFormat:@"%s", list[listLength]]];
}
I have already tried 'stringByAppendingFormat' and SEVERAL others. No luck.. =(
Thank you for any help you can offer!
- Steven French