Nessuna descrizione

FKGuideManager.m 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // FLIntroductionHelper.m
  3. // FirstLink
  4. //
  5. // Created by unicode on 14-9-28.
  6. // Copyright (c) 2014年 FirstLink. All rights reserved.
  7. //
  8. #import "FKGuideManager.h"
  9. #import "FirstLinkAppDelegate.h"
  10. #import "FLControllerHelper.h"
  11. #import "FKSexGuideController.h"
  12. #import "GuideViewController.h"
  13. #define SUCCESS_SHOW_ONCE_GUIDE @"SUCCESS_SHOW_ONCE_GUIDE"
  14. @implementation FKGuideManager
  15. + (BOOL)isNeedShowGuideController {
  16. if ([FKGuideManager isFirstLaunchApplication]
  17. || [SystemUtil isApplicationUpdate]) {
  18. return YES;
  19. }
  20. return NO;
  21. }
  22. + (void)showGuideController {
  23. UITabBarController *tabbarController = (UITabBarController*)[[UIApplication sharedApplication] keyWindow].rootViewController;
  24. if ([tabbarController isKindOfClass:[UITabBarController class]]) {
  25. UIViewController *newViewController = [[FLControllerHelper currentStoryBoard] instantiateViewControllerWithIdentifier:@"GuideViewController"];
  26. [[FLControllerHelper currentController] presentViewController:newViewController animated:NO completion:^{
  27. }];
  28. }
  29. }
  30. + (BOOL)isFirstLaunchApplication {
  31. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  32. NSInteger count = [userDefault integerForKey:SUCCESS_SHOW_ONCE_GUIDE];
  33. if (!count) {
  34. return YES;
  35. }
  36. return NO;
  37. }
  38. + (BOOL)successShowOnceGuide {
  39. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  40. NSInteger count = [userDefault integerForKey:SUCCESS_SHOW_ONCE_GUIDE];
  41. [userDefault setInteger:(count + 1) forKey:SUCCESS_SHOW_ONCE_GUIDE];
  42. return [userDefault synchronize];
  43. }
  44. @end