| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- //
- // MyTeamController.m
- // model
- //
- // Created by Drew on 2018/10/29.
- // Copyright © 2018 Mine. All rights reserved.
- //
- #import "MyModelController.h"
- #import "MyTeamCell.h"
- #import "MyTeamHeader.h"
- static NSString *cellId = @"MyTeamCell";
- @interface MyModelController () <UITableViewDelegate, UITableViewDataSource>
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property(nonatomic,strong) NSMutableArray* data;
- @property(nonatomic, strong) UIView* tableHeader;
- @end
- @implementation MyModelController
- - (void)viewDidLoad {
- [super viewDidLoad];
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- btn.frame = CGRectMake(0, 0, 40, 40);
- [btn setImage:[UIImage imageNamed:@"backBtn"] forState:UIControlStateNormal];
- btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
- [btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
- UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
- UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
- nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
- self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
- self.navigationItem.title = @"推广明细";
-
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- self.tableView.tableHeaderView = self.tableHeader;
- }
- - (void)backClick {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (NSMutableArray *)data {
- if (!_data) {
- _data = [NSMutableArray arrayWithCapacity:0];
- }
- return _data;
- }
- - (UIView *)tableHeader {
- if(!_tableHeader){
- _tableHeader = [[MyTeamHeader alloc] init];
- _tableHeader.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 107);
- }
- return _tableHeader;
- }
- # pragma mark - TableView Delegate
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return 1;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- // return self.data.count;
- return 10;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- MyTeamCell *cell = [self.tableView dequeueReusableCellWithIdentifier:cellId];
- if (!cell) {
- NSArray *nib = [[NSBundle mainBundle] loadNibNamed:cellId owner:self options:nil];
- cell = [nib objectAtIndex:0];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 70;
- }
- # pragma mark -
- @end
|