#importextern NSString *const IsFirstOpenApp;
extern NSString *const GuideViewControllerDidFinish;
#importNSString * const IsFirstOpenApp = @"isFirstOpenApp";
NSString * const GuideViewController = @"GuideViewControllerDidFinish";
#import "AppDelegate.h"
#import "AppConst.h"
#import "GuideViewController.h"
#import "MainTabBarController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self addNotification];
[self buildKeyWindow];
return YES;
}
- (void)buildKeyWindow {
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
[self.window makeKeyAndVisible];
NSString *isFirstOpenApp = [[NSUserDefaults standardUserDefaults]objectForKey:IsFirstOpenApp];
if (isFirstOpenApp == nil) {
self.window.rootViewController = [[GuideViewController alloc]init];
[[NSUserDefaults standardUserDefaults] setObject:IsFirstOpenApp forKey:IsFirstOpenApp];
}else {
[self loadAdRootController];
}
}
- (void)addNotification{
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showMainTabBarController) name:GuideViewControllerDidFinish object:nil];
}
- (void)showMainTabBarController {
self.window.rootViewController = [[MainTabBarController alloc]init];
}
- (void)loadAdRootController {
self.window.rootViewController = [[MainTabBarController alloc]init];
}
//- (void)dealloc {
//
// [[NSNotificationCenter defaultCenter]removeObserver:self];
//}
#import "GuideViewController.h"
#import "AppConst.h"
@interface GuideViewController ()
@property (nonatomic,strong) UIButton *button;
@end
@implementation GuideViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blueColor];
// self.button = [[UIButton alloc]init];
// self.button setBackgroundImage:<#(nullable UIImage *)#> forState:<#(UIControlState)#>
// self.button.hidden = true;
// [self.button addTarget:self action:@selector(nextButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
// [self.view addSubview:_button];
}
- (void)nextButtonClicked:(UIButton *)button {
// [[NSNotificationCenter defaultCenter]postNotificationName:GuideViewControllerDidFinish object:nil];
}