starting ios project without storyboard

前端 未结 9 1228
渐次进展
渐次进展 2021-01-12 23:28

Im having some troubles to start an iOS app using xibs instead of storyboard. The problem is that im getting a black screen and the first view controller is not being called

9条回答
  •  囚心锁ツ
    2021-01-12 23:56

    Hope this helps you:

    Delete the view controller and storyboard file and new viewController.h,viewController.h.m ,viewController.xib file.

     #import "AppDelegate.h"
    
     @interface AppDelegate ()
    
     @end
    
     @implementation AppDelegate
     @synthesize viewCOntrollerobj;
    
     - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
         self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
         self.viewCOntrollerobj = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
         UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.viewCOntrollerobj];
         //navController.navigationBarHidden = YES;
    
         self.window.rootViewController = navController;
         [self.window makeKeyAndVisible];
         return YES;
    
    }  
    

提交回复
热议问题