TFRootViewController.m 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // TFRootViewController.m
  3. // RA TradeFiling
  4. //
  5. // Created by Rui Zhang on 11/13/20.
  6. //
  7. #import "TFRootViewController.h"
  8. @interface TFRootViewController ()
  9. @end
  10. @implementation TFRootViewController
  11. - (void)viewDidLoad {
  12. [super viewDidLoad];
  13. // Do any additional setup after loading the view.
  14. // AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  15. //
  16. // LoginViewController * loginVC = [ [UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginPanel"];
  17. // loginVC.loginSuccessful = ^(void)
  18. // {
  19. // appDelegate.isLogin = YES;
  20. // appDelegate.shouldCheckCache = YES;
  21. // // 登陆成功后重新刷新tabbar
  22. // self.viewControllers = self.loginbar;
  23. // };
  24. //// loginVC.tabBarItem = [self itemWithSelectedImage:@"login" image:@"login" title:@"login"];
  25. //// ToolslistViewController* toolVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ToolsPanel"];
  26. //
  27. //
  28. // ToolslistViewController *toolVC=[[ToolslistViewController alloc] initWithNibName:@"StaticModelistViewController" bundle:nil];
  29. //
  30. //
  31. //
  32. // SearchlistViewController* searchVC = [[SearchlistViewController alloc] initWithNibName:@"StaticModelistViewController" bundle:nil];
  33. // //[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"SearchPanel"];
  34. // MylistViewController* myVC = [[MylistViewController alloc] initWithNibName:@"StaticModelistViewController" bundle:nil];
  35. //
  36. // myVC.logoutSuccessful = ^(void)
  37. // {
  38. // appDelegate.isLogin = NO;
  39. // // 登陆成功后重新刷新tabbar
  40. // self.viewControllers = self.logout_bar;
  41. // };
  42. // //[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"MyPanel"];
  43. // OrderHistoryViewController* historyVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"HistoryPanel"];
  44. //// toolVC.tabBarItem = [self itemWithSelectedImage:@"tools" image:@"tools" title:@"tools"];
  45. // // Do any additional setup after loading the view.
  46. //
  47. //
  48. // self.logout_bar = @[loginVC,toolVC];
  49. // self.login_bar = @[homeVC,historyVC,searchVC,toolVC,myVC];
  50. // self.viewControllers = self.logoutbar;
  51. //
  52. // UIImage *logo = [[UIImage imageNamed:@"navigate_logo"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  53. // UIBarButtonItem *logoItem = [[UIBarButtonItem alloc] initWithImage:logo landscapeImagePhone:logo style:UIBarButtonItemStylePlain target:nil action:nil];
  54. // logoItem.enabled = NO;
  55. // self.tabBarController.navigationItem.leftBarButtonItem = logoItem;
  56. //
  57. //
  58. //
  59. // UIBarButtonItem *welcomeItem =[[UIBarButtonItem alloc] initWithTitle:[NSString stringWithFormat:@"Welcome: %@",RASingleton.sharedInstance.firstName] menu:nil];
  60. // welcomeItem.enabled = NO;
  61. // self.tabBarController.navigationItem.rightBarButtonItem =welcomeItem;
  62. }
  63. -(void) setup{
  64. // AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  65. //
  66. LoginViewController * loginVC = [ [UIStoryboard storyboardWithName:@"Login" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginPanel"];
  67. AboutViewController * aboutVC = [ [UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateViewControllerWithIdentifier:@"AboutViewController"];
  68. RAHomeViewController* homeVC = [[UIStoryboard storyboardWithName:@"Home" bundle:nil] instantiateViewControllerWithIdentifier:@"RAHomeViewController"];
  69. MylistViewController* myVC = [[MylistViewController alloc] initWithNibName:@"StaticModelistViewController" bundle:nil];
  70. self.logout_bar = @[loginVC,aboutVC];
  71. self.login_bar = @[homeVC,myVC,aboutVC]; //homeVC,historyVC,searchVC,toolVC,
  72. self.viewControllers = self.logout_bar;
  73. self.tabBar.tintColor =SecondaryTextColor;
  74. }
  75. - (void)handleNotification:(NSNotification *)notification {
  76. // NSAssert(true, @"setup does not implement");
  77. // AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  78. if ([notification.name isEqualToString:RA_NOTIFICATION_LOGOUT]) {
  79. // [appDelegate Logout];
  80. // [(LoginViewController *)self.logoutbar.firstObject clear];
  81. self.viewControllers = self.logout_bar;
  82. self.selectedIndex = 0;
  83. // [self.navigationController.navigationBar setHidden:true];
  84. //
  85. }
  86. else if ([notification.name isEqualToString:RA_NOTIFICATION_LOGIN])
  87. {
  88. // [self.navigationController.navigationBar setHidden:false];
  89. self.viewControllers = self.login_bar;
  90. self.selectedIndex = 0;
  91. }
  92. }
  93. /*
  94. #pragma mark - Navigation
  95. // In a storyboard-based application, you will often want to do a little preparation before navigation
  96. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  97. // Get the new view controller using [segue destinationViewController].
  98. // Pass the selected object to the new view controller.
  99. }
  100. */
  101. @end