WFCUMessageNotificationViewController.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // MessageNotificationViewController.m
  3. // WildFireChat
  4. //
  5. // Created by heavyrain lee on 07/01/2018.
  6. // Copyright © 2018 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCUMessageNotificationViewController.h"
  9. #import "WFCUSwitchTableViewCell.h"
  10. #import "UIColor+YH.h"
  11. @interface WFCUMessageNotificationViewController () <UITableViewDataSource, UITableViewDelegate>
  12. @property (nonatomic, strong)UITableView *tableView;
  13. @end
  14. @implementation WFCUMessageNotificationViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. self.title = WFCString(@"NewMessageNotification");
  18. self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
  19. self.tableView.backgroundColor = [UIColor colorWithHexString:@"0xededed"];
  20. self.tableView.delegate = self;
  21. self.tableView.dataSource = self;
  22. self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  23. self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  24. [self.tableView reloadData];
  25. [self.view addSubview:self.tableView];
  26. }
  27. - (void)didReceiveMemoryWarning {
  28. [super didReceiveMemoryWarning];
  29. // Dispose of any resources that can be recreated.
  30. }
  31. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  32. return 48;
  33. }
  34. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  35. if (section == 0) {
  36. return 0.1;
  37. } else {
  38. return 9;
  39. }
  40. }
  41. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  42. if (section == 0) {
  43. return nil;
  44. } else {
  45. UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 9)];
  46. view.backgroundColor = [UIColor colorWithHexString:@"0xededed"];
  47. return view;
  48. }
  49. }
  50. //#pragma mark - Table view data source
  51. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  52. return 2;
  53. }
  54. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  55. if (section == 0) {
  56. return 1;
  57. } else if (section == 1) {
  58. return 1;
  59. }
  60. return 0;
  61. }
  62. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  63. WFCUSwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"styleSwitch"];
  64. if(cell == nil) {
  65. cell = [[WFCUSwitchTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"styleSwitch" conversation:nil];
  66. }
  67. cell.detailTextLabel.text = nil;
  68. cell.accessoryType = UITableViewCellAccessoryNone;
  69. cell.accessoryView = nil;
  70. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  71. if (indexPath.section == 0) {
  72. cell.textLabel.text = WFCString(@"ReceiveNewMessageNotification");
  73. cell.type = SwitchType_Setting_Global_Silent;
  74. } else {
  75. cell.textLabel.text = WFCString(@"NotificationShowMessageDetail");
  76. cell.type = SwitchType_Setting_Show_Notification_Detail;
  77. }
  78. return cell;
  79. }
  80. @end