Created
March 15, 2011 00:31
-
-
Save frijole/870125 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NEW RANDOM ACTION | |
NSString *lineSources = [[NSBundle mainBundle] pathForResource:@"quotes" ofType:@"plist"]; | |
NSDictionary *lines = [[NSDictionary alloc] initWithContentsOfFile:lineSources]; | |
NSMutableArray *line1Strings = [lines valueForKey:@"line1"]; | |
NSMutableArray *line2Strings = [lines valueForKey:@"line2"]; | |
NSMutableArray *line3Strings = [lines valueForKey:@"line3"]; | |
NSMutableArray *line4Strings = [lines valueForKey:@"line4"]; | |
NSMutableArray *line5Strings = [lines valueForKey:@"line5"]; | |
NSMutableArray *line6Strings = [lines valueForKey:@"line6"]; | |
int random[6]; for (int n = 0; n < 6; n++) {random[n] = arc4random() % [line1Strings count];}; | |
line1Text.text = [line1Strings objectAtIndex:random[0]]; | |
line2Text.text = [line2Strings objectAtIndex:random[1]]; | |
line3Text.text = [line3Strings objectAtIndex:random[2]]; | |
line4Text.text = [line4Strings objectAtIndex:random[3]]; | |
line5Text.text = [line5Strings objectAtIndex:random[4]]; | |
line6Text.text = [line6Strings objectAtIndex:random[5]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment