I changed "Launch Screen File" to my "Main.Storyboard" in settings. Before doing this app was working fine, and opened directly without any problem. But after adding this there was a black screen before the launch of storyboard. This is very bad user experience. Help me to solve this. AppDelegate and viewController has nothing big. I have a LaunchScreen.xib in project and also LaunchImage in image assets. I am using Storyboard in project. I don't want a launchScreen in my app, I just wanna directly go to my storyboard.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window?.rootViewController = utilitiesObjet.getViewController("MainVC", mainStoryBoardName: "Main")
self.window?.makeKeyAndVisible()
Fabric.with([Crashlytics.self()])
return true
}
I solved it by adding a LaunchScreen.StoryBoard, Instead of using a LaunchScreen.xib. Thank you All :)
use this code in appdelegate this code for objective c .....did finish launching with option method...
self.winow = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"<Your Storyboard name>" bundle:nil];
LoginViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"<your view controller storyboard identifer name>"];
UINavigationController *navigationController=[[UINavigationController alloc] initWithRootViewController:ivc];
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
For Swift....
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
// Override point for customization after application launch.
let storyboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let navigationController:UINavigationController = storyboard.instantiateInitialViewController() as UINavigationController
let rootViewController:UIViewController = storyboard.instantiateViewControllerWithIdentifier("VC") as UIViewController
navigationController.viewControllers = [rootViewController]
self.window?.rootViewController = navigationController
return true
}
Launch Screen different Main.StoryBoard. In Launch Screen File, you must type: "LaunchScreen" and choose file Lscreen.storyboard (xcode7), or .xib if Xcode6
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.