ios xib文件使用
来源:互联网 发布:英语口语精华软件 编辑:程序博客网 时间:2024/04/29 01:20
xib虽然已经过时,但维护旧的ios应用时会遇到。
使用方式
1、创建ios工程
2、创建Cocos touch文件,继承自UIViewController,并勾选 Also create xib file,文件名假设为MyViewController
创建完成后工程结构
3.xib文件中拖拉控件
4、AppDelegate.m文件
//// AppDelegate.m// viewcollection//// Created by Young on 15/10/9.// Copyright (c) 2015年 Young. All rights reserved.//#import "AppDelegate.h"#import "MyViewController.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. //创建UIWindow,大小为screen大小 self.window=[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; //调用UIViewController的initWithNibName方法,使用MyViewController.xib文件创建ui UIViewController* rootControl=[[MyViewController alloc]initWithNibName:@"MyViewController" bundle:nil]; //设置根rootViewController self.window.rootViewController=rootControl; //设为可见 [self.window makeKeyAndVisible]; return YES;}- (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.}- (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.}- (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.}- (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.}- (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.}@end
运行效果
0 0
- ios xib文件使用
- IOS Xib使用——为控制器添加Xib文件
- IOS Xib使用——为控制器添加Xib文件
- iOS XIB文件的简单创建使用
- iOS 在 xib 文件中使用 UIScrollView
- ios xib文件加载xib
- iOS 加载xib文件
- iOS Xib文件详解
- IOS:IOS自定义xib文件的使用笔记
- IOS UITableView 使用xib
- ios – 使用UINib加载xib文件实现UITableViewCell
- ios使用UINib加载xib文件实现UITableViewCell
- IOS基础学习笔记二:Bundle加载文件、XIB使用
- ios – 使用UINib加载xib文件实现UITableViewCell
- ios – 使用UINib加载xib文件实现UITableViewCell
- Xib文件使用
- Xib文件使用
- Xib文件使用
- PCA理论与传统PCA图像融合
- Chi-square Calculator(计算两个种类的相关性)
- nginx优化
- 隐私问题警告:此文档中包含宏、ActiveX控件、XML扩展包信息或Web组件......
- 将四个空格换成制表符\t 并去掉首尾空格
- ios xib文件使用
- 使用Cocopods遇到的一些问题
- String、int。long之间的相互转化
- jvm工具系列之 -- jhat
- OO:XmlParser 网页分析和 爬虫
- jQuery的Deferred对象测试笔记以及源码分析
- Anjularjs控制器通信
- python数据结构学习笔记-2-算法
- LIB和DLL的区别与使用