SearchlistViewController.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // SearchlistViewController.m
  3. // Apex Mobile
  4. //
  5. // Created by Ray on 25/01/2018.
  6. // Copyright © 2018 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "SearchlistViewController.h"
  9. #import "SearchViewController.h"
  10. @interface SearchlistViewController ()
  11. @end
  12. @implementation SearchlistViewController
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. // Do any additional setup after loading the view.
  16. }
  17. - (void)didReceiveMemoryWarning {
  18. [super didReceiveMemoryWarning];
  19. // Dispose of any resources that can be recreated.
  20. }
  21. - (void)viewWillAppear:(BOOL)animated {
  22. [super viewWillAppear:animated];
  23. [self clearNavigationbar];
  24. [self configureNavigationBar];
  25. }
  26. - (void)clearNavigationbar {
  27. self.tabBarController.navigationItem.leftBarButtonItem = nil;
  28. self.tabBarController.navigationItem.leftBarButtonItems = nil;
  29. self.tabBarController.navigationItem.titleView = nil;
  30. self.tabBarController.navigationItem.title = nil;
  31. self.tabBarController.navigationItem.rightBarButtonItem = nil;
  32. self.tabBarController.navigationItem.rightBarButtonItems = nil;
  33. }
  34. - (void)configureNavigationBar {
  35. if (self.navigationController && !self.navigationController.isNavigationBarHidden) {
  36. UIImage *logo = [[UIImage imageNamed:@"apexlogo-2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  37. UIBarButtonItem *logoItem = [[UIBarButtonItem alloc] initWithImage:logo landscapeImagePhone:logo style:UIBarButtonItemStylePlain target:nil action:nil];
  38. logoItem.enabled = NO;
  39. self.tabBarController.navigationItem.leftBarButtonItem = logoItem;
  40. }
  41. }
  42. - (void)LoadModelist
  43. {
  44. NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"search" ofType:@"json" ]];
  45. if(json==nil)
  46. {
  47. self.modelist = nil;
  48. }
  49. NSError *error=nil;
  50. NSDictionary* modelistjson = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error] ;
  51. self.modelist = modelistjson[@"modelist"];
  52. // self.navigationItem.title = ;
  53. self.title = modelistjson[@"title"];
  54. self.tabBarItem.image= [UIImage imageNamed:modelistjson[@"icon"]];
  55. // NSAssert(true, ([NSString stringWithFormat:@"%s LoadModelist not impl",object_getClassName([self class])]));
  56. }
  57. -(void)PerformAction:(NSString*) type
  58. {
  59. NSString *function_name;
  60. if([type isEqualToString:@"ocean_booking"])
  61. {
  62. function_name = @"Ocean Booking";
  63. }
  64. else if([type isEqualToString:@"ocean_blinfo"])
  65. {
  66. function_name = @"Ocean B/L info.";
  67. }
  68. else if([type isEqualToString:@"container_detail"])
  69. {
  70. function_name = @"Container detail";
  71. }
  72. else if([type isEqualToString:@"document"])
  73. {
  74. function_name = @"Download Document";
  75. }
  76. SearchViewController *searchViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"SearchViewController"];
  77. searchViewController.function_name = function_name;
  78. [self.navigationController pushViewController:searchViewController animated:YES];
  79. }
  80. /*
  81. #pragma mark - Navigation
  82. // In a storyboard-based application, you will often want to do a little preparation before navigation
  83. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  84. // Get the new view controller using [segue destinationViewController].
  85. // Pass the selected object to the new view controller.
  86. }
  87. */
  88. @end