Working on a senior project, and my app started to load only a black screen after the splash screen recently. I am not using storyboards. I've been searching for a solution to this problem, but cannot seem to adapt other solutions to my project. My [github] ( https://github.com/cleif/Hastings/tree/Fixed ) has the latest build here. Below is code from my AppDelegate.h & .m files.
.h
#import <UIKit/UIKit.h>
#import "IIViewDeckController.h"
#import "MenuViewController.h"
#import "HomeViewController.h"
#import "AboutViewController.h"
#import "AthleticsViewController.h"
#import "BroncoBoardViewController.h"
#import "ContactsTableViewController.h"
#import "MapViewController.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (retain, nonatomic) UIViewController *menuViewController;
@property (retain, nonatomic) UIViewController *rootViewController;
@end
.m
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize menuViewController = _menuViewController;
- (IIViewDeckController*) initializeMainViewControllers {
UIViewController *menuViewController = [[MenuViewController alloc] init];
UIViewController *rootViewController = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
IIViewDeckController* deckController = [[IIViewDeckController alloc] initWithCenterViewController:[[UINavigationController alloc] initWithRootViewController:rootViewController]
leftViewController:menuViewController];
return deckController;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
IIViewDeckController* deckController = [self initializeMainViewControllers];
self.menuViewController = deckController.leftController;
self.rootViewController = deckController.centerController;
self.window.rootViewController = deckController;
[self.window makeKeyAndVisible];
return YES;
}
@end
Any Suggestions on this would be greatly appreciated.
i got your code and added below line to - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions and it is working fine now
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
so your didFinishLaunchingWithOptions method must be like this
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
IIViewDeckController* deckController = [self initializeMainViewControllers];
self.menuViewController = deckController.leftController;
self.rootViewController = deckController.centerController;
self.window.rootViewController = deckController;
[self.window makeKeyAndVisible];
return YES;
}
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.