*************HMAppDelegate.m中

@implementation HMAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor]; //storyboard
[self vcFromStoryboard]; //代码
// HMOneViewController *vc = [[HMOneViewController alloc] init];
// vc.view.backgroundColor = [UIColor grayColor];
//
// self.window.rootViewController = vc; //xib
HMThreeViewController *threeVc = [[HMThreeViewController alloc] initWithNibName:@"Three168" bundle:nil];
self.window.rootViewController = threeVc;
[self.window makeKeyAndVisible];
return YES;
} //来自storyboard控制器
-(void)vcFromStoryboard{
//设置UIWindow根控制器 //第一方法 从storyboard获取控制器
//1.1获取storyboard对象
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Test" bundle:nil]; //1.2获取storyboard的第一个控制器(箭头所指的控制器)
//UIViewController *vc = [storyboard instantiateInitialViewController]; //获取storyborad指定id的控制器
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SecordVC"]; NSLog(@"%@",vc); //1.3设置窗口的根控制器
self.window.rootViewController = vc;
}

***第一个view的创建

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor purpleColor]; //HMOneViewController *oneVc = [[HMOneViewController alloc] initWithNibName:@"OneView168" bundle:nil]; //HMOneViewController *oneVc = [[HMOneViewController alloc] initWithNibName:@"HMOneView" bundle:nil]; //1.如果没有指定xib ,默认会查找与控制器名Controller以前的文字的xib(HMOneView.xib)
//2.如果没有HMOneView.xib 接着就找与控制器同名xib(HMOneViewController.xib)
//3.如果没有找与控制器同名的xib,自己创建一个空白view
// UIView *view = [UIView allloc] init]; oneVc.view = view HMOneViewController *oneVc = [[HMOneViewController alloc] init];
self.window.rootViewController = oneVc;
NSLog(@"aaaaaaaaaa");
[self.window makeKeyAndVisible];
NSLog(@"bbbbbbbbbb"); //viewDidLoad
//aaaaa
//bbbbb //aaaaa
//viewDidLoad
//bbbbb return YES;
}

IOS第12天(1,UIViewController控制器的创建的 三种方式,和第一个view创建)的更多相关文章

  1. iOS字体加载三种方式

    静态加载 动态加载 动态下载苹果提供的多种字体 其他 打印出当前所有可用的字体 检查某字体是否已经下载 这是一篇很简短的文章,介绍了 iOS 自定义字体加载的三种方式. 静态加载 这个可以说是最简单最 ...

  2. 基于MVC4+EasyUI的Web开发框架经验总结(12)--利用Jquery处理数据交互的几种方式

    在基于MVC4+EasyUI的Web开发框架里面,大量采用了Jquery的方法,对数据进行请求或者提交,方便页面和服务器后端进行数据的交互处理.本文主要介绍利用Jquery处理数据交互的几种方式,包括 ...

  3. ios网络学习------4 UIWebView的加载本地数据的三种方式

    ios网络学习------4 UIWebView的加载本地数据的三种方式 分类: IOS2014-06-27 12:56 959人阅读 评论(0) 收藏 举报 UIWebView是IOS内置的浏览器, ...

  4. iOS --- UIWebView的加载本地数据的三种方式

    UIWebView是IOS内置的浏览器,可以浏览网页,打开文档  html/htm  pdf   docx  txt等格式的文件.  safari浏览器就是通过UIWebView做的. 服务器将MIM ...

  5. iOS拨打电话的三种方式

    iOS拨打电话的三种方式 1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示 1 2 var string = "tel:" + "1 ...

  6. IOS 多线程,线程同步的三种方式

    本文主要是讲述 IOS 多线程,线程同步的三种方式,更多IOS技术知识,请登陆疯狂软件教育官网. 一般情况下我们使用线程,在多个线程共同访问同一块资源.为保护线程资源的安全和线程访问的正确性. 在IO ...

  7. ios学习网络------4 UIWebView以三种方式中的本地数据

    UIWebView这是IOS内置的浏览器.能够浏览网页,打开文档  html/htm  pdf   docx  txt等待格文档类型. safari浏览器是通过UIWebView制作. server将 ...

  8. MVC中控制器向视图传值的四种方式

    MVC中的控制器向视图传值有四种方式分别是 1 ViewDate  2.ViewBag   3.TempDate  4.Model 下面分别介绍四种传值方式 首先先显示出控制器中的代码 using S ...

  9. iOS开发 跳转场景的三种方式

    iOS开发 跳转场景的三种方式 2012年10月17日, 15:32 假设A跳转到B,三种方法:1.按住ctrl键,拖动A上的控件(比如说UIButton)到B上,弹出菜单,选择Modal.不需要写任 ...

随机推荐

  1. vim使用02

    编辑 剪切光标所在的字符: <x>; 剪切并插入: <s> 撤销操作:撤销至上一个命令之间的修改: <u> 恢复上一次撤销操作: <C r> 剪切光标所 ...

  2. no-jquery 02 DOM

    DOM Manipulation Creating Elements // IE 5.5+ document.createElement('div'); Inserting Elements Befo ...

  3. js:方法2. 字符串

    String.charAt()/String.charCodeAt() string.charAt(n); n:The index of the character that should be re ...

  4. Windows64 系统下Python、NumPy与matplotlib 安装方法

    今下午想用Python跑RNN网络,结果代码在导入包numpy时并没有报错,但是在用里面的函数时报错,因小编也是新手,只学习了Python的基础语法,并没有使用过第三方包,安装了一下午还没弄好,本以为 ...

  5. BestCoder Round #72 (div.2)

    后面的题目补不懂了 暴力 1001 Clarke and chemistry 这题也把我搞死了..枚举系数判断就行了 #include <cstdio> #include <algo ...

  6. spring mvc 解决后台传递值乱码问题

    在Web-xml 配置添加过滤器 <!-- 配置过滤器 解决乱码问题 --> <filter> <filter-name>CharacterEncodingFilt ...

  7. Java String类的常用方法

    String(byte[ ] bytes):通过byte数组构造字符串对象. String(char[ ] value):通过char数组构造字符串对象. String(Sting original) ...

  8. [转]走向视网膜(Retina)的Web时代

    转载出处:http://www.w3cplus.com/css/towards-retina-web.html 维基百科将Retina译为“视网膜”."Retina"一词,原意是“ ...

  9. HDU5724 Chess(SG定理)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5724 Description Alice and Bob are playing a spe ...

  10. ural 1251. Cemetery Manager

    1251. Cemetery Manager Time limit: 1.0 secondMemory limit: 64 MB There is a tradition at the USU cha ...