• 59.加载Viewcontroller的几种方法(添加导航,解决xib里面空间不显示问题)


    // 一、根据StoryboardID(需要在Storyboard设置),通过ViewController所在的Storyboard来加载:
    
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"FicowVC"];

    
    

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

        UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"FicowVC"];

        

        UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];

        self.window.rootViewController = nav;

        [self.window makeKeyAndVisible];

        

        return YES;

    }




    // 二、通过UIViewController对应的.xib文件加载:
    UIViewController *vc = [[UIViewController alloc] initWithNibName:@"FicowVC" bundle:nil];
    
    
    
    
    // 三、直接加载UIViewController类:
    UIViewController *vc = [[UIViewController alloc] init];
    
    
    
    /*
    注意:
    loadNibNamed和initWithNibName需要加载的xib文件是不一样的。
    initWithNibName需要加载的xib文件的File Owner应改是需要加载的类,
    而loadNibNamed需要加载的xib文件的File Owner为NSObject。
    */
  • 相关阅读:
    OpenFileMapping
    findwindow
    CopyMemory
    SetWindowsHookEx
    fillchar
    什么是ashx文件
    WPF中的控件
    WPF X名称空间里都有什么
    XAML语法学习之...
    Repeater控件使用总结
  • 原文地址:https://www.cnblogs.com/qiangzheVSruozhe/p/9395756.html
Copyright © 2020-2023  润新知