转自:http://my.oschina.net/simple2012/blog/96487
1.使用extern关键字
在AppDelegate.m或AppDelegate.h中写入你需要的全局变量名,例如:int name;注意定义全局变量时候不能初始化,否则报错。
AppDelegate.h文件中:
#import <UIKit/UIKit.h>
BOOL isClickHouseList;
@interface AppDelegate : UIResponder
{}
在需要调用的.m文件中声明 extern int name; 然后就可以使用了。
extern BOOL isClickHouseList;
@
@implementation LeveyTabBarController {
isClickHouseList=true;
}