使用appdelegate的变量做全局变量的方法
来源:互联网 发布:json数组解析 编辑:程序博客网 时间:2024/05/14 20:01
使用appdelegate的变量做全局变量的方法:
1.用宏:
#define kAppDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
2.在appdelegate上加一个类方法,返回appdelegate:
static AppDelegate *appDeleagate=nil;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
appDeleagate=self;
}
+(AppDelegate *)delegate{
return appDeleagate;
}
原帖:http://my.oschina.net/openlab/blog/151950
0 0
- 使用appdelegate的变量做全局变量的方法
- 用appDelegate的全局变量
- 项目里面访问AppDelegate做全局变量的方式
- AppDelegate.h中各个方法的使用
- appDelegate的几个方法
- AppDelegate的方法意义
- AppDelegate的使用
- AppDelegate里面的方法们
- AppDelegate各个方法的作用
- android使用全局变量的方法
- QT 使用全局变量的方法
- 单片机全局变量和局部变量的使用 .
- 单片机全局变量和局部变量的使用
- python 的全局变量global变量使用
- C++全局变量和静态变量的使用
- Python: 全局变量 & 局部变量的使用
- cpp全局变量和局部变量的使用
- ios 获取AppDelegate对象的成员变量
- Missing include: urn:docbkx:stylesheet
- Asp.net用回车键提交
- #include“stdafx.h”详解
- phpcms 源码分析
- 注解apt工具示例程序
- 使用appdelegate的变量做全局变量的方法
- coe_xfr_sql_profile.sql
- python2.7练习 写一个简单的文本编辑器
- C++ Primer第四版习题--3.10
- MyBatis (2)配置
- OpenCV 获取摄像头并显示摄像头视频
- Another app is currently holding the yum lock; The other application is: yum-updatesd-he
- python中的深拷贝和浅拷贝理解
- 利用qmake来为15.04及以上target创建Ubuntu应用项目