佚名通过本文主要向大家介绍了single application,single view,single record view,scene view,sight view scene等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: single view application中删除默认的scene,创建导航视图不能显示
描述:
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var navigationcontr:UINavigationController?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let mainSB = UIStoryboard(name: "Main", bundle: nil)
self.navigationcontr = mainSB.instantiateViewControllerWithIdentifier("test") as? UINavigationController
self.window?.rootViewController = navigationcontr
return true
}
}
解决方案1:
描述:
Navigation
如题,在xcode 7.3中创建的single view application后,删除了默认的scene,然后拖动一个UINavigationController到SB,这时生成两个场景,其中一个是UINavigationController的实例(ID:test),另一个是UITableViewController的实例,此时编写AppDelegate.swift文件,大致如下(省略了其它默认方法):程序能运行,但是显示为黑屏class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var navigationcontr:UINavigationController?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let mainSB = UIStoryboard(name: "Main", bundle: nil)
self.navigationcontr = mainSB.instantiateViewControllerWithIdentifier("test") as? UINavigationController
self.window?.rootViewController = navigationcontr
return true
}
}
解决方案1:
self.window makekeyandvi啥的把这句话写上,swift忘了这句话咋写,建议先把OC学好