Objective C - Pick random NIB file?
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
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.
精彩评论