例: 定义和使用一个全局变量"isLogin"
AppDelegate.h
@interface AppDelegate :UIResponder <UIApplicationDelegate>
@property (strong,nonatomic)UIWindow *window;
@propertyBOOL isLogin;
@end
@implementation AppDelegate
@synthesize window =_window;
@synthesize isLogin;
@end
AppDelegate *delegate=(AppDelegate*)[[UIApplicationsharedApplication]delegate];
delegate.isLogin=YES;