问题
Hello I would like to have my app pick a randome XIB file to choose from, and exclude 3 of them.
HowToPlay *LetsPlay = [[HowToPlay alloc] initWithNibName:@"HowToPlay" bundle:nil];
LetsPlay.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:LetsPlay animated:YES];
[LetsPlay release];
So i know how to load from a nib file by doing the above, but i would like it to be able to pick a random one and then exclude certain ones.
The ones i want excluded: MainViewController, FlipSideViewController, HowToPlay
Ones i want: Question 1, Question 2, and so on....
Any ideas of how i can do this?
Thanks!. Have a great day
回答1:
You could put the nib names you want (represented as NSString
) in a NSArray
, then generate a random number and pick up one nib name from the array.
来源:https://stackoverflow.com/questions/6621141/objective-c-pick-random-nib-file