FavoritesViewController.m 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //
  2. // FavoritesViewController.m
  3. // Apex Mobile
  4. //
  5. // Created by Ray on 14-4-25.
  6. // Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "FavoritesViewController.h"
  9. @interface FavoritesViewController ()
  10. @end
  11. @implementation FavoritesViewController
  12. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  13. {
  14. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  15. if (self) {
  16. // Custom initialization
  17. }
  18. return self;
  19. }
  20. - (void)viewDidLoad
  21. {
  22. [super viewDidLoad];
  23. self.data =[[FavoritesData alloc]init];
  24. [self.tableview reloadData];
  25. }
  26. -(void)viewWillAppear:(BOOL)animated
  27. {
  28. }
  29. - (void)didReceiveMemoryWarning
  30. {
  31. [super didReceiveMemoryWarning];
  32. // Dispose of any resources that can be recreated.
  33. }
  34. /*
  35. #pragma mark - Navigation
  36. // In a storyboard-based application, you will often want to do a little preparation before navigation
  37. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  38. {
  39. // Get the new view controller using [segue destinationViewController].
  40. // Pass the selected object to the new view controller.
  41. }
  42. */
  43. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  44. {
  45. return 1;
  46. }
  47. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  48. {
  49. return [self.data get_count];
  50. }
  51. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  52. {
  53. DebugLog(@"cellForRowAtIndexPath");
  54. NSString *CellIdentifier = @"cell_item_history";
  55. CellItemHistory *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  56. NSString* name = [self.data.pagedata[indexPath.row] valueForKey:@"name"];
  57. NSString* create_time = [self.data.pagedata[indexPath.row] valueForKey:@"create_time"];
  58. cell.name.text = name;
  59. [cell.name sizeToFit];
  60. cell.time.text =create_time;
  61. [cell.time sizeToFit];
  62. // cell.imageView.image = [UIImage imageNamed:[self.toolsinfo[indexPath.row] valueForKey:@"img"]];
  63. return cell;
  64. }
  65. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  66. {
  67. // NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithDictionary:self.params copyItems:true];
  68. NSString* str_params =[self.data.pagedata[indexPath.row] valueForKey:@"params"];
  69. NSData* data_params = [str_params dataUsingEncoding:NSUTF8StringEncoding];
  70. NSMutableDictionary* params = [[NSMutableDictionary alloc] initWithDictionary:[NSJSONSerialization
  71. JSONObjectWithData:data_params
  72. options:NSJSONReadingMutableLeaves
  73. error:nil] copyItems:true];
  74. NSString * str_actions =[self.data.pagedata[indexPath.row] valueForKey:@"action"];
  75. NSArray* actions = [str_actions componentsSeparatedByString:@","];
  76. NSString* function_name = [self.data.pagedata[indexPath.row] valueForKey:@"module_name"];
  77. DetailTabBarController *detailViewController=[[DetailTabBarController alloc] init:function_name actions:actions params:params];
  78. // DetailTabBarController *detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailTabBarController"];
  79. // detailViewController.function_name = self.function_name;
  80. // detailViewController.actions = self.actions;
  81. // detailViewController.params =params;
  82. [self.navigationController pushViewController:detailViewController animated:YES];
  83. }
  84. @end