MyMemberController.m 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // MyTeamController.m
  3. // model
  4. //
  5. // Created by Drew on 2018/10/29.
  6. // Copyright © 2018 Mine. All rights reserved.
  7. //
  8. #import "MyMemberController.h"
  9. #import "MyTeamCell.h"
  10. #import "MyTeamHeader.h"
  11. static NSString *cellId = @"MyTeamCell";
  12. @interface MyMemberController () <UITableViewDelegate, UITableViewDataSource>
  13. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  14. @property(nonatomic,strong) NSMutableArray* data;
  15. @property(nonatomic, strong) UIView* tableHeader;
  16. @end
  17. @implementation MyMemberController
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  21. btn.frame = CGRectMake(0, 0, 40, 40);
  22. [btn setImage:[UIImage imageNamed:@"backBtn"] forState:UIControlStateNormal];
  23. btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
  24. [btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
  25. UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
  26. UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
  27. nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
  28. self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
  29. self.navigationItem.title = @"推广明细";
  30. self.tableView.delegate = self;
  31. self.tableView.dataSource = self;
  32. self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  33. self.tableView.tableHeaderView = self.tableHeader;
  34. }
  35. - (void)backClick {
  36. [self.navigationController popViewControllerAnimated:YES];
  37. }
  38. - (NSMutableArray *)data {
  39. if (!_data) {
  40. _data = [NSMutableArray arrayWithCapacity:0];
  41. }
  42. return _data;
  43. }
  44. - (UIView *)tableHeader {
  45. if(!_tableHeader){
  46. _tableHeader = [[MyTeamHeader alloc] init];
  47. _tableHeader.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 107);
  48. }
  49. return _tableHeader;
  50. }
  51. # pragma mark - TableView Delegate
  52. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  53. return 1;
  54. }
  55. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  56. // return self.data.count;
  57. return 10;
  58. }
  59. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  60. MyTeamCell *cell = [self.tableView dequeueReusableCellWithIdentifier:cellId];
  61. if (!cell) {
  62. NSArray *nib = [[NSBundle mainBundle] loadNibNamed:cellId owner:self options:nil];
  63. cell = [nib objectAtIndex:0];
  64. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  65. }
  66. return cell;
  67. }
  68. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  69. return 70;
  70. }
  71. # pragma mark -
  72. @end