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

前端 未结 3 1380
谎友^
谎友^ 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-03 00:04

    add new file in that select the cococatouch and select the Objective -C class and then go to the next click.
    you show the below screen
    at the bottom must select the with xib for user Interface.and next

    AppDelegate.h:

    @class ViewController;
    @interface AppDelegate : UIResponder 
    {
        ViewController *viewObj;
        UINavigationController *navObj;
    }
    @property (strong, nonatomic) UIWindow *window;
    @property (strong, nonatomic)  ViewController *viewObj;
    @property (strong, nonatomic) UINavigationController *navObj;
    

    AppDelegate.m:

    @synthesize viewObj,window,navObj;
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        viewObj = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
        navObj = [[UINavigationController alloc] initWithRootViewController:viewObj];
    
        window.rootViewController=navObj;
        [window makeKeyAndVisible];
    
        return YES;
    }
    

    enter image description here

提交回复
热议问题