我正试图在app delegate中启动时在两个故事板之间做出决定。 首先,我删除了Info.plist中的NSMainStoryboardFile = Main条目,以防止自动加载Storyboard。
然后我尝试从AppDelegate加载主故事板,但这不起作用。
<section class="artistpage">
<ul class="artistlist" ng-app>
<li ng-animate="animate'" class="artist cf" ng-repeat="lec in lecture | orderBy: videoId">
<div class="info">
<h2>{{lec.videoName}}</h2>
<h3>{{lec.videoDetails | cut:true:160:' ...'}}</h3>
</div>
</li>
</ul>
</section>
我不确定为什么。 希望有人可以提供帮助。
答案 0 :(得分:0)
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
window=UIWindow(frame: UIScreen.mainScreen().bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let navigationController:UINavigationController = storyboard.instantiateInitialViewController() as! UINavigationController
var rootViewController:UIViewController = storyboard.instantiateViewControllerWithIdentifier("LoginView") // LoginView is your view controller name
navigationController.viewControllers = [rootViewController]
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()
window?.backgroundColor=UIColor.blackColor()
return true
}
答案 1 :(得分:0)
这应该完美无缺 -
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
var sb = UIStoryboard(name: "Main", bundle: nil)
var initialVC = storyboard.instantiateInitialViewController() as! UIViewController
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
return true
}