【发布时间】:2014-04-01 21:35:58
【问题描述】:
这是我在 Stackoverflow 上的第一篇文章,所以我想说“你好”。原谅我英语不好:) 我在 Stackoverflow 上阅读了许多主题来解决我的问题,但我是一个完全的初学者,所以我无法让我的应用程序按照我想要的方式运行。
如果应用程序首次启动,我想呈现动画的模态视图控制器 - 如果不是,则不应显示“介绍视图”。
我有 Xcode 5 + iOS7 模拟器。我在“Main.storyboard”文件中有两个 ViewController。其中之一“是初始视图控制器”。
如果第一次启动应用程序,我已经找到了做某事的方法,然后将其同步到设置(在“AppDelegate.m”文件中):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
UIColor *tintColor = [UIColor colorWithRed:137/255.0f green:116/255.0f blue:62/255.0f alpha:1.0];
[[UIButton appearance] setTintColor:tintColor];
[[UISegmentedControl appearance] setTintColor:tintColor];
[[UIAlertView appearance]setTintColor:tintColor];
BOOL ranBefore = [[NSUserDefaults standardUserDefaults] boolForKey:@"ranBefore"];
if (!ranBefore) {
//////DISPLAY SECOND (not "is initial view controller") VIEW CONTROLLER HERE\\\\\\
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"ranBefore"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
return YES;
}
我该怎么做?就像我说的那样,即使是其他帖子的复制粘贴也无法解决我的问题(我是初学者:P)。能否请您为我制作一个有效的 Xcode 项目并通过我的电子邮件地址发送?
【问题讨论】:
标签: ios iphone xcode5 modalviewcontroller