iPhone开发中实现代码初始化APP中Window
iPhone开发中实现代码初始化APP中Window是本文要介绍的内容,主要是来学习在iphone开发中如何来初始化APP里的Window,该例介绍如何用代码这创建iPhone的app的window,这样可以使我们的app不依赖任何nib文件,完全邮代码实现。
1、创建基于"window-based application"的新项目"CodingWindowDemo";
2、删除MainWindow.xib文件;
3、删除CodingWindowDemo-Info.plist文件中"Main nib file base name"行;
4、修改main.m代码:
将原来行: int retVal = UIApplicationMain(argc, argv, nil, nil); 改为: int retVal = UIApplicationMain(argc, argv, nil, @"CodingWindowDemoAppDelegate");
5、修改CodingWindowDemoAppDelegate.h后代码如下:
#import <UIKit/UIKit.h>@interface CodingWindowDemoAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window;}//@property (nonatomic, retain) IBOutlet UIWindow *window;@end
6、修改CodingWindowDemoAppDelegate.m后代码如下:
相关推荐
liuxudong00 2020-11-19
xuegangic 2020-10-17
章鱼之家 2020-10-29
leitingdulante 2020-10-21
硬币0 2020-10-15
ZuoYanDeHuangHun 2020-09-18
chsoft 2020-09-17
MatrixHero 2020-08-20
XxZproject 2020-08-10
定格 2020-08-15
Mryiyi 2020-08-07
ydc0 2020-07-30
yechen00 2020-07-25
孝平 2020-07-18
ntfsformac 2020-06-23
好好学习天天 2020-06-12
Charliewolf 2020-06-05
MAC2007 2020-06-04
fanxiaoxuan 2020-06-03