| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- //
- // 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) MyTeamHeader* tableHeader;
- @end
- @implementation MyModelController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- self.tableView.tableHeaderView = self.tableHeader;
-
- [self getData];
- }
- - (void)getData {
- ModelUser *modelUser = [ModelUser user];
- NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:modelUser.pk, @"memberpk", @"7", @"type", nil];
- [YanCNetWorkManager requestPostWithURLStr:Url_myTeam(PublicUrl)
- parameters:dic
- finish:^(id responese) {
- BOOL success = [responese[@"success"] intValue] == 1;
- if (success) {
- self.tableHeader.introduceNum = [responese[@"introduceNum"] stringValue];
- self.tableHeader.totalCoin = [responese[@"totalCoin"] stringValue];
- [self.data addObjectsFromArray:responese[@"introduceList"]];
- [self.tableView reloadData];
- } else {
- [MBProgressHUD showInfo:@"请求失败!"];
- }
- } enError:^(NSError *error) {
- }];
- }
- - (NSMutableArray *)data {
- if (!_data) {
- _data = [NSMutableArray arrayWithCapacity:0];
- }
- return _data;
- }
- - (UIView *)tableHeader {
- if(!_tableHeader){
- _tableHeader = [[MyTeamHeader alloc] init];
- _tableHeader.frame = CGRectMake(0, 0, ScreenWidth, 107);
- _tableHeader.type = @"model";
- }
- return _tableHeader;
- }
- # pragma mark - TableView Delegate
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return 1;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return self.data.count;
- }
- -(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;
- cell.data = [self.data objectAtIndex:indexPath.row];
- }
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 70;
- }
- # pragma mark -
- @end
|