SettingViewController.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //
  2. // SettingViewController.m
  3. // RedAnt ERP Mobile
  4. //
  5. // Created by Ray on 14-8-4.
  6. // Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "SettingViewController.h"
  9. #import "CacheViewController.h"
  10. //#import "CacheSettingViewController.h"
  11. @interface SettingViewController ()
  12. @end
  13. @implementation SettingViewController
  14. - (IBAction)CloseClick:(id)sender {
  15. [self dismissViewControllerAnimated:true completion:nil];
  16. }
  17. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  18. {
  19. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  20. if (self) {
  21. // Custom initialization
  22. }
  23. return self;
  24. }
  25. -(void)initMenuItems
  26. {
  27. self.settingMenuItems = [[NSMutableArray alloc] init];
  28. NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
  29. [map setValue:@"Cache" forKey:@"title"];
  30. [map setValue:@"rect_market_news" forKey:@"img"];
  31. [self.settingMenuItems addObject:map.copy];
  32. [map setValue:@"Price" forKey:@"title"];
  33. [map setValue:@"rect_market_news" forKey:@"img"];
  34. [self.settingMenuItems addObject:map.copy];
  35. [map setValue:@"Notification" forKey:@"title"];
  36. [map setValue:@"rect_announcements" forKey:@"img"];
  37. [self.settingMenuItems addObject:map.copy];
  38. // NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  39. //
  40. // [map setValue:@"Message" forKey:@"title"];
  41. // [map setValue:@"rect_search_history" forKey:@"img"];
  42. // [self.settingMenuItems addObject:map.copy];
  43. //
  44. //
  45. // [map setValue:@"About" forKey:@"title"];
  46. // [map setValue:@"rect_change_password" forKey:@"img"];
  47. // [self.settingMenuItems addObject:map.copy];
  48. //
  49. //
  50. }
  51. - (void)viewDidLoad
  52. {
  53. [super viewDidLoad];
  54. [self initMenuItems];
  55. // Do any additional setup after loading the view.
  56. }
  57. - (void)didReceiveMemoryWarning
  58. {
  59. [super didReceiveMemoryWarning];
  60. // Dispose of any resources that can be recreated.
  61. }
  62. /*
  63. #pragma mark - Navigation
  64. // In a storyboard-based application, you will often want to do a little preparation before navigation
  65. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  66. {
  67. // Get the new view controller using [segue destinationViewController].
  68. // Pass the selected object to the new view controller.
  69. }
  70. */
  71. #pragma mark - Table view data source
  72. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  73. {
  74. return 1;
  75. }
  76. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  77. {
  78. return self.settingMenuItems.count;
  79. }
  80. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  81. {
  82. NSString *CellIdentifier = @"SettingCell";
  83. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  84. NSString* title = [self.settingMenuItems[indexPath.row] valueForKey:@"title"];
  85. cell.backgroundColor = [UIColor clearColor];
  86. // [cell.backgroundColor:[UIColor clearColor]];
  87. // UIImageView* iv= [[UIImageView alloc] initWithImage:];
  88. cell.textLabel.text = title;
  89. // cell.imageView.image = [UIImage imageNamed:[self.toolsinfo[indexPath.row] valueForKey:@"img"]];
  90. return cell;
  91. }
  92. #pragma mark - Table view delegate
  93. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  94. {
  95. NSString* title = [self.settingMenuItems[indexPath.row] valueForKey:@"title"];
  96. if([title isEqualToString:@"Cache"])
  97. {
  98. CacheViewController* tvc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CacheViewController" ];
  99. [self.navigationController pushViewController:tvc animated:true];
  100. }
  101. else if([title isEqualToString:@"Price"])
  102. {
  103. // [self hideMenu];
  104. // if([self.current_VC isKindOfClass:[WatchListViewController class]])
  105. // return;
  106. // [self flipFromViewController:self.current_VC toViewController:self.watchListViewController withDirection:UIViewAnimationOptionTransitionCrossDissolve];
  107. }
  108. }
  109. @end