Open zxwcool opened 8 years ago
(BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
.............
.............
.............
UIViewController *rootCtr = [[UIViewController alloc] init];
UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:rootCtr];
[rootCtr.view addSubview:menu];
[self.window setRootViewController:nav];
// [self.window addSubview:menu];
[self.window makeKeyAndVisible];
return YES;
}
There is no root view controller in your application delegate, so your demo crashed and I fixed it!
............. ............. ............. UIViewController rootCtr = [[UIViewController alloc] init]; UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:rootCtr]; [rootCtr.view addSubview:menu]; [self.window setRootViewController:nav]; // [self.window addSubview:menu]; [self.window makeKeyAndVisible]; return YES; }