ios全局变量。。

来源:互联网 发布:linux的ntp部署 编辑:程序博客网 时间:2024/06/10 23:50

在应用程序的Delegate中申明

#import <UIKit/UIKit.h> #import "Member.h" @interface  AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property Member *loginMember;//我的全局变量 @end 

然后

#import "AppDelegate.h" @implementation AppDelegate @synthesize window = _window; @synthesize loginMember;

在其它的class .m文件中调用:

//我的应用程序的delegate叫AppDelegate AppDelegate *app = (AppDelegate*)[[UIApplication sharedApplication] delegate];

原创粉丝点击