项目里面访问AppDelegate做全局变量的方式

来源:互联网 发布:淘宝商城运营 编辑:程序博客网 时间:2024/05/20 03:08

.h文件中

+ (AppDelegate *)sharedAppDelegate;

.m文件中

+ (AppDelegate *)sharedAppDelegate {

    return (AppDelegate *)[UIApplicationsharedApplication].delegate;

}

引用时

[AppDelegatesharedAppDelegate].window.rootViewController = [[AppDelegatesharedAppDelegate] produceNewTabBarViewController];



0 0
原创粉丝点击