WFCPrivacyTableViewController.m 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // WFCPrivacyTableViewController.h
  3. // WFChat UIKit
  4. //
  5. // Created by WF Chat on 2017/10/6.
  6. // Copyright © 2017年 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCPrivacyTableViewController.h"
  9. #import <WFChatClient/WFCChatClient.h>
  10. #import <WFChatUIKit/WFChatUIKit.h>
  11. @interface WFCPrivacyTableViewController () <UITableViewDataSource, UITableViewDelegate>
  12. @property (nonatomic, strong)UITableView *tableView;
  13. @end
  14. @implementation WFCPrivacyTableViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. self.view.backgroundColor = [UIColor whiteColor];
  18. self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped];
  19. self.tableView.delegate = self;
  20. self.tableView.dataSource = self;
  21. self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  22. [self.tableView reloadData];
  23. [self.view addSubview:self.tableView];
  24. }
  25. - (void)didReceiveMemoryWarning {
  26. [super didReceiveMemoryWarning];
  27. // Dispose of any resources that can be recreated.
  28. }
  29. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  30. return 48;
  31. }
  32. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  33. if (indexPath.section == 0) {
  34. WFCUBlackListViewController *vc = [[WFCUBlackListViewController alloc] init];
  35. [self.navigationController pushViewController:vc animated:YES];
  36. } else if(indexPath.section == 1) {
  37. UIViewController *vc = [[NSClassFromString(@"MomentSettingsTableViewController") alloc] init];
  38. [self.navigationController pushViewController:vc animated:YES];
  39. }
  40. }
  41. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  42. return [[UIView alloc] initWithFrame:CGRectZero];
  43. }
  44. //#pragma mark - Table view data source
  45. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  46. if (NSClassFromString(@"MomentSettingsTableViewController")) {
  47. return 2;
  48. }
  49. return 1;
  50. }
  51. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  52. if (section == 0) {
  53. return 1;
  54. } else if(section == 1) {
  55. return 1;
  56. }
  57. return 0;
  58. }
  59. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  60. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"style1Cell"];
  61. if (cell == nil) {
  62. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"style1Cell"];
  63. }
  64. cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  65. cell.accessoryView = nil;
  66. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  67. if (indexPath.section == 0) {
  68. cell.textLabel.text = LocalizedString(@"Blacklist");
  69. } else if(indexPath.section == 1) {
  70. cell.textLabel.text = LocalizedString(@"Moments");
  71. }
  72. return cell;
  73. }
  74. @end