NewInterfaceReplacement.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // NewInterfaceReplacement.m
  3. // MingMen
  4. //
  5. // Created by 罗云飞 on 2017/5/19.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "NewInterfaceReplacement.h"
  9. #import "HuanXinHelper.h"
  10. @implementation NewInterfaceReplacement
  11. static NewInterfaceReplacement *sharedObj = nil;
  12. + (instancetype)sharedInstance
  13. {
  14. static dispatch_once_t onceToken = 0;
  15. dispatch_once(&onceToken, ^{
  16. sharedObj = [[super allocWithZone: NULL] init];
  17. });
  18. return sharedObj;
  19. }
  20. + (id) allocWithZone:(struct _NSZone *)zone
  21. {
  22. return [self sharedInstance];
  23. }
  24. - (id) copyWithZone:(NSZone *) zone
  25. {
  26. return self;
  27. }
  28. - (void)replacementLogin
  29. {
  30. //退出云信账号、解绑阿里云推送账号、删除用户单例类以及本地缓存保存的数据
  31. [UserHelper exitLogin];
  32. //退出环信账号
  33. [[HuanXinHelper sharedInstance] exitlogon];
  34. //销毁之前的单利对象
  35. [NewBasicTabbarController objectDealloc];
  36. //给予系统0.5秒清除本地数据
  37. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  38. // 跳转登录界面
  39. // NewLoginViewController *startVc = [[NewLoginViewController alloc] init];
  40. // UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:startVc];
  41. // [AppDelegate shareDelegate].window.rootViewController = navi;
  42. });
  43. }
  44. - (void)replacementController
  45. {
  46. //进入程序主控制界面
  47. [[AppDelegate shareDelegate].window setRootViewController:[NewBasicTabbarController sharedInstance]];
  48. }
  49. @end