WFCUMessageNotificationViewController.m 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. @interface WFCUMessageNotificationViewController () <UITableViewDataSource, UITableViewDelegate>
  11. @property (nonatomic, strong)UITableView *tableView;
  12. @end
  13. @implementation WFCUMessageNotificationViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. self.title = @"新消息通知";
  17. self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped];
  18. self.tableView.delegate = self;
  19. self.tableView.dataSource = self;
  20. self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  21. [self.tableView reloadData];
  22. [self.view addSubview:self.tableView];
  23. }
  24. - (void)didReceiveMemoryWarning {
  25. [super didReceiveMemoryWarning];
  26. // Dispose of any resources that can be recreated.
  27. }
  28. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  29. return 48;
  30. }
  31. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  32. return [[UIView alloc] initWithFrame:CGRectZero];
  33. }
  34. //#pragma mark - Table view data source
  35. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  36. return 2;
  37. }
  38. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  39. if (section == 0) {
  40. return 1;
  41. } else if (section == 1) {
  42. return 1;
  43. }
  44. return 0;
  45. }
  46. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  47. WFCUSwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"styleSwitch"];
  48. if(cell == nil) {
  49. cell = [[WFCUSwitchTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"styleSwitch" conversation:nil];
  50. }
  51. cell.detailTextLabel.text = nil;
  52. cell.accessoryType = UITableViewCellAccessoryNone;
  53. cell.accessoryView = nil;
  54. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  55. if (indexPath.section == 0) {
  56. cell.textLabel.text = @"接收新消息通知";
  57. cell.type = SwitchType_Setting_Global_Silent;
  58. } else {
  59. cell.textLabel.text = @"通知显示消息详情";
  60. cell.type = SwitchType_Setting_Show_Notification_Detail;
  61. }
  62. return cell;
  63. }
  64. @end