- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我想要一种方法让用户在应用程序首次启动时有一个欢迎屏幕/教程。如果这不是应用程序的第一次启动,那么它会像往常一样打开。
如果应用程序正常打开,我已经将欢迎屏幕绑定(bind)到按钮功能。我正在使用 BWWalkThroughViewController
。这是我的按钮功能代码:
@IBAction func showWalkThroughButtonPressed() {
// Get view controllers and build the walkthrough
let stb = UIStoryboard(name: "MainStoryboard", bundle: nil)
let walkthrough = stb.instantiateViewControllerWithIdentifier("walk0") as! BWWalkthroughViewController
let page_one = stb.instantiateViewControllerWithIdentifier("walk1") as UIViewController
let page_two = stb.instantiateViewControllerWithIdentifier("walk2") as UIViewController
let page_three = stb.instantiateViewControllerWithIdentifier("walk3") as UIViewController
let page_four = stb.instantiateViewControllerWithIdentifier("walk4") as UIViewController
let page_five = stb.instantiateViewControllerWithIdentifier("walk5") as UIViewController
// Attach the pages to the master
walkthrough.delegate = self
walkthrough.addViewController(page_one)
walkthrough.addViewController(page_two)
walkthrough.addViewController(page_three)
walkthrough.addViewController(page_four)
walkthrough.addViewController(page_five)
self.presentViewController(walkthrough, animated: true, completion: nil)
}
func walkthroughCloseButtonPressed() {
self.dismissViewControllerAnimated(true, completion: nil)
}
该代码位于 MyTableViewController.swift 文件中。
这是我想不通的:
我希望 View Controller 在首次启动时显示。用户完成教程后,他们可以按关闭按钮,它就会关闭。我有代码来检查它是否是该应用程序的首次启动。它位于 AppDelegate.swift 文件中。这是代码:
// First Launch Check
let notFirstLaunch = NSUserDefaults.standardUserDefaults().boolForKey("FirstLaunch")
if notFirstLaunch {
print("First launch, setting NSUserDefault")
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "FirstLaunch")
}
else {
print("Not first launch.")
}
return true
那么如何让欢迎屏幕在首次启动时启动?我是否必须在 AppDelegate 中创建一个函数来处理这个问题,如果是这样,我必须做些什么才能使教程成为首次启动的初始 View Controller ?
最佳答案
我相信您需要做的已经在这里涵盖:Programmatically set the initial view controller using Storyboards .如果这对您不起作用,请添加更多关于实现失败原因的注释。在谷歌上搜索“在启动 ios 时以编程方式更改 uiviewcontroller”将产生其他类似的链接。
关于ios - 启动时的欢迎屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34187067/
这是我第一次使用 NSIS,我正在尝试制作一个使用 MUI2 的安装程序,但进展不太顺利。当我编译代码时,我没有收到任何错误,因此它可以编译,但我收到了大量警告。首先,它发生在一个稍微复杂的安装程序中
我创建了一个递归 DFS 算法来用 Java 生成/解决数独板,但它需要永远终止,欢迎提供解释/优化。我无法想象生成数独板会如此耗时,尤其是周围有所有应用程序(尽管它们可能有数据库。) 基本上,我遍历
我搜索了很多,但没有找到答案。我开发了一个 Android 应用程序,在第一次午餐时,用户将看到一个由 viewpager 制成的欢迎屏幕。问题是我不知道哪个位置最适合将欢迎 Activity 代码放
是否可以在 media/popular 的 instagram API 中为特定主题标签设置过滤器? 也可以(如果可能):/tags/tag-name/media/recent 按喜欢排序 他们的文档
我正在尝试用 Swift 编写一个 iOS 应用程序,在标签栏屏幕之前会有一个初始屏幕。 我看过: > http://sweettutos.com/2014/01/08/present-a-login
我是 Rails 的新手,我有一个带有视频模型、 Controller 和 View 的应用。 我正在弄清楚如何查询和显示我想要的视频,到目前为止,当我使用视频 Controller 时一切顺利。 我
我在其他线程中尝试了一些建议(例如在启动时强制注销),但我还没有找到解决这个问题的方法。问题在于这个弹出窗口: 它似乎非常不一致,很少出现。 我添加了一个 GameHelper.logout()在我的
我正在尝试使用 Spring MVC 来完成此操作:我的欢迎页面是位于我的/webapp 文件夹中的 index.jsp,因此可以将其设置为欢迎页面。该页面有一个登录表单。当登录失败时,我想重定向到此
在安装了 Ruby 2.3.3、Rails 5.0.0.1 和 NodeJS 4.2.6 的 Ubuntu 16.04 上,我使用 bin/rails generate controller welc
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 7 年前。 Improve
好的,事情是这样的。我的一个客户声称他在使用 Safari 浏览器的 Macbook Pro 上查看网站时看不到社交图标(在屏幕的左侧)。这些图标在我测试过的所有设备上都清晰可见。是否有任何 Macb
我是一名优秀的程序员,十分优秀!