目标C-选择随机的NIB文件? [英] Objective C - Pick random NIB file?

查看:92
本文介绍了目标C-选择随机的NIB文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想让我的应用选择一个随机XIB文件供您选择,并排除其中的3个.

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];

所以我知道如何通过上述操作从nib文件加载,但是我希望它能够选择一个随机文件,然后排除某些文件.

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.

我要排除的那些: MainViewController, FlipSideViewController, 如何玩

The ones i want excluded: MainViewController, FlipSideViewController, HowToPlay

我想要的: 问题1 问题2, 等等...

Ones i want: Question 1, Question 2, and so on....

我如何做到这一点的任何想法?

Any ideas of how i can do this?

谢谢!.祝你有美好的一天

Thanks!. Have a great day

推荐答案

您可以将所需的笔尖名称(表示为NSString)放在NSArray中,然后生成一个随机数并从中选择一个笔尖名称.数组.

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.

这篇关于目标C-选择随机的NIB文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆