DocumentsViewController.m 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //
  2. // DocumentsViewController.m
  3. // Apex Mobile
  4. //
  5. // Created by Ray on 14-5-5.
  6. // Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "DocumentsViewController.h"
  9. @interface DocumentsViewController ()
  10. @end
  11. @implementation DocumentsViewController
  12. -(void)initpanel
  13. {
  14. self.toolsinfo = [[NSMutableArray alloc] init];
  15. NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
  16. [map setValue:@"Search documents" forKey:@"title"];
  17. [map setValue:@"rect_search_documents" forKey:@"img"];
  18. [self.toolsinfo addObject:map.copy];
  19. [map setValue:@"View document" forKey:@"title"];
  20. [map setValue:@"rect_view_download_documents" forKey:@"img"];
  21. [self.toolsinfo addObject:map.copy];
  22. }
  23. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  24. {
  25. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  26. if (self) {
  27. // Custom initialization
  28. }
  29. return self;
  30. }
  31. - (void)viewDidLoad
  32. {
  33. [super viewDidLoad];
  34. // Do any additional setup after loading the view.
  35. [self initpanel];
  36. }
  37. - (void)didReceiveMemoryWarning
  38. {
  39. [super didReceiveMemoryWarning];
  40. // Dispose of any resources that can be recreated.
  41. }
  42. /*
  43. #pragma mark - Navigation
  44. // In a storyboard-based application, you will often want to do a little preparation before navigation
  45. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  46. {
  47. // Get the new view controller using [segue destinationViewController].
  48. // Pass the selected object to the new view controller.
  49. }
  50. */
  51. - (BOOL)shouldAutorotate
  52. {
  53. return YES;
  54. }
  55. - (NSUInteger)supportedInterfaceOrientations
  56. {
  57. return UIInterfaceOrientationMaskPortrait;
  58. }
  59. - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  60. {
  61. return UIInterfaceOrientationPortrait;
  62. }
  63. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  64. {
  65. return 1;
  66. }
  67. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  68. {
  69. return self.toolsinfo.count;
  70. }
  71. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  72. {
  73. DebugLog(@"cellForRowAtIndexPath");
  74. NSString *CellIdentifier = @"documents";
  75. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  76. NSString* title = [self.toolsinfo[indexPath.row] valueForKey:@"title"];
  77. // UIImageView* iv= [[UIImageView alloc] initWithImage:];
  78. cell.textLabel.text = title;
  79. cell.imageView.image = [UIImage imageNamed:[self.toolsinfo[indexPath.row] valueForKey:@"img"]];
  80. return cell;
  81. }
  82. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  83. {
  84. // SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"NewsView"];
  85. // searchViewController.function_name = @"Download Document";
  86. // [self.navigationController pushViewController:searchViewController animated:YES];
  87. // return;
  88. NSString* title = [self.toolsinfo[indexPath.row] valueForKey:@"title"];
  89. if([title isEqualToString:@"Search documents"])
  90. {
  91. SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
  92. searchViewController.function_name = @"Download Document";
  93. [self.navigationController pushViewController:searchViewController animated:YES];
  94. }
  95. else if([title isEqualToString:@"View document"])
  96. {
  97. LocalDocumentsViewController *viewcontroller=[self.storyboard instantiateViewControllerWithIdentifier:@"LocalDocumentsViewController"];
  98. // viewcontroller.module_name = @"Announcements";
  99. [self.navigationController pushViewController:viewcontroller animated:YES];
  100. }
  101. }
  102. @end