当用户接受EULA

时间:2015-10-27 01:40:25

标签: ios swift uiviewcontroller swift2

我希望这是一个简单的问题。我没有找到任何符合我试图做的东西。我正在研究我的第一个项目,这对我来说还是很新的。我粘贴的代码来自我在使用真实代码添加代码之前使用的测试项目。

我最初的VC是EULA。当用户接受时,我想将初始VC更改为日志视图。在这个测试项目中,我有一个IBAction的{​​{1}}视图,它将项目从VC转移到VC2。我正在尝试设置代码以使用

更改AppDelegate中的初始VC
Bar Button Item

但这不起作用。首先,func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. let storyboard = UIStoryboard(name: "View Controller", bundle: NSBundle.mainBundle()) let licenseAccepted = ? var vc: UIViewController? if !licenseAccepted { vc = storyboard.instantiateViewControllerWithIdentifier("View Controller2") } else { vc = storyboard.instantiateInitialViewController() } window = UIWindow(frame: UIScreen.mainScreen().bounds) window?.rootViewController = vc window?.makeKeyAndVisible() return true } 不正确。我发现在另一组代码中,我认为它可能有用,但没有。另外,如果用户接受AppDelegate中的许可证,如何设置var?应该在初始VC中完成,第二个VC将成为初始VC还是其他地方?

如果有帮助,我正在使用Xcode 7.1和Swift2。

我可能会离开基地,或者我可能是一次或两次击打。我只是不理解这个问题。我们将非常感谢您的协助。

0 个答案:

没有答案