How can i use xib files instead of storyboard in Xcode 5?

前端 未结 3 1353
谎友^
谎友^ 2021-01-02 23:08

I\'m very new to ios developing and many of the tutorials i watch follow the xib approach since they were recorded before XCode 5. How can i go with the xib approach in Sing

3条回答
  •  有刺的猬
    2021-01-02 23:46

    you can do it by following these steps:-

    • Create a new project
    • Select Single View Application
    • Set ProjectName and other settings
    • Save Project at location
    • Select Project in Navigator Panel in Left
    • Remove Main.storyboard file from project
    • Add New .xib file in Project
    • Set Main Interface to your .xib file in "General Tab" on right panel.
    • Paste following code in didFinishLaunchingWithOptions method

      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
      self.viewController = [[ViewController alloc] initWithNibName:@"YourViewController" bundle:nil];
      self.window.rootViewController = self.viewController;
      [self.window makeKeyAndVisible];
      

    Courtesy:- MKR

    https://stackoverflow.com/a/19633059/1865424

    Just check it have you missed any of the step.

提交回复
热议问题