CYLaunchViewController.m 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // CYLaunchViewController.m
  3. // shiku_im
  4. //
  5. // Copyright © 2019 Reese. All rights reserved.
  6. //
  7. #import "CYLaunchViewController.h"
  8. @interface CYLaunchViewController ()
  9. @property (nonatomic,strong) NSTimer *timer;
  10. @property (nonatomic,strong) UIButton *button;
  11. @property (nonatomic,strong) UIImageView *imgView;
  12. @end
  13. @implementation CYLaunchViewController{
  14. int a ;
  15. }
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. // Do any additional setup after loading the view.
  19. //启动页
  20. self.imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
  21. // self.imgView.image = [UIImage imageNamed:@"IMG_4803.png"];
  22. // self.imgView.image = [UIImage imageWithData:data];
  23. self.imgView.image = [UIImage imageNamed:@"LaunchImage"];
  24. // self.imgView.userInteractionEnabled = YES;
  25. // imgView.backgroundColor = UIColor.redColor;
  26. [self.view addSubview:self.imgView];
  27. // [g_server getappLogoIcon:self];
  28. // [g_server getCompanyAuto:self];
  29. AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager];
  30. [manager startMonitoring];
  31. [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
  32. if (status == AFNetworkReachabilityStatusReachableViaWWAN || status == AFNetworkReachabilityStatusReachableViaWiFi) {
  33. __weak typeof(self)weakSelf = self;
  34. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1), dispatch_get_main_queue(), ^{
  35. [weakSelf goToLoginVc];
  36. });
  37. }else {
  38. [g_App showAlert:@"网络不可用,请检查网络"];
  39. }
  40. }];
  41. }
  42. -(void)gotoLoginClick{
  43. [self.timer invalidate];
  44. self.timer = nil;
  45. [g_App showLoginUI];
  46. }
  47. -(void)goToLoginVc{
  48. if (a == 0) {
  49. [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:@"cylunch"];
  50. [[NSUserDefaults standardUserDefaults] synchronize];
  51. [g_App showLoginUI];
  52. [self.timer invalidate];
  53. self.timer = nil;
  54. }
  55. [self.button setTitle:[NSString stringWithFormat:@"跳过 %ds",a] forState:UIControlStateNormal];
  56. a -= 1;
  57. }
  58. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  59. }
  60. /*
  61. #pragma mark - Navigation
  62. // In a storyboard-based application, you will often want to do a little preparation before navigation
  63. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  64. // Get the new view controller using [segue destinationViewController].
  65. // Pass the selected object to the new view controller.
  66. }
  67. */
  68. @end