Guest User

Untitled

a guest
Sep 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. applicationDidBecomeActive: Fails to push appropriate view
  2. - (void)applicationDidBecomeActive:(UIApplication *)application
  3. {
  4. // to check the session
  5. XTabViewController *XTabViewCon = [[XTabViewController alloc] init];
  6. [XTabViewCon pushViewUponCheckedSession];
  7. [XTabViewCon release];
  8. }
  9.  
  10. - (void)pushViewUponCheckedSession {
  11. //THIS IS VERY IMPORTANT. IT CHECKS FOR SESSION
  12. if ([[[ApplicationContext alloc] dataManager ] checkSession]) {
  13. [self showSessionAliveView];
  14. //here I can write something that will push a view that was seen last before leaving app to inactive state. May be NSNotification could help me
  15. }
  16. else {
  17. [self showSessionTimeOutView];
  18. }
  19. }
  20. - (void)showSessionTimeOutView {
  21. //show activity indi
  22. waitingIndicator = [[MyWaitingIndicator alloc]init];
  23. [self.view addSubview:waitingIndicator];
  24. [waitingIndicator setHidden:YES];
  25. [waitingIndicator stopAnimating];
  26. //push session timeout view
  27. SessionTimeOutViewController *sessionTimeOutView = [[SessionTimeOutViewController alloc] init];
  28. [[self navigationController] pushViewController:sessionTimeOutView animated:NO];
  29. [sessionTimeOutView release];
  30. [waitingIndicator release];
  31. }
  32.  
  33. - (void)showSessionAliveView {
  34. SessionAliveView *sessionAliveViewList = [[SessionAliveView alloc] init];
  35. [[self navigationController] pushViewController:sessionAliveViewList animated:YES];
  36. [sessionAliveViewList release];
  37. }
  38.  
  39. - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
  40. //if X Tab is selected then & only then call this method
  41. if (tabBarController.selectedIndex == 2) {
  42. [XTabViewCon pushViewUponCheckedSession];
  43. }
  44.  
  45. }
Add Comment
Please, Sign In to add comment