61 lines
1.5 KiB
Objective-C
61 lines
1.5 KiB
Objective-C
//
|
|
// YYXinrenTop3View.m
|
|
// SweetParty
|
|
//
|
|
// Created by MAC on 2024/3/7.
|
|
//
|
|
|
|
#import "YYXinrenTop3View.h"
|
|
#import "YYXinrenTop3Cell.h"
|
|
|
|
@interface YYXinrenTop3View () <UITableViewDelegate, UITableViewDataSource>
|
|
|
|
@end
|
|
|
|
@implementation YYXinrenTop3View
|
|
|
|
- (void)awakeFromNib {
|
|
[super awakeFromNib];
|
|
|
|
[self createUI];
|
|
}
|
|
|
|
- (void)createUI {
|
|
self.tableView.separatorStyle = NO;
|
|
self.tableView.delegate = self;
|
|
self.tableView.dataSource = self;
|
|
|
|
[self.tableView registerNib:[UINib nibWithNibName:@"YYXinrenTop3Cell" bundle:nil] forCellReuseIdentifier:@"YYXinrenTop3Cell"];
|
|
self.tableView.rowHeight = 40;
|
|
}
|
|
|
|
- (void)setDataArray:(NSArray *)dataArray {
|
|
_dataArray = dataArray;
|
|
|
|
self.hidden = dataArray.count <= 0;
|
|
[self.tableView reloadData];
|
|
}
|
|
|
|
#pragma mark - Table view data source
|
|
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
|
return 1;
|
|
}
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
return self.dataArray.count;
|
|
}
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
YYXinrenTop3Cell *cell = [tableView dequeueReusableCellWithIdentifier:@"YYXinrenTop3Cell" forIndexPath:indexPath];
|
|
cell.selectionStyle = NO;
|
|
YYXinrenTop3Model *model = self.dataArray[indexPath.row];
|
|
cell.model = model;
|
|
|
|
cell.orderLab.text = [NSString stringWithFormat:@"%ld", indexPath.row+1];
|
|
|
|
return cell;
|
|
}
|
|
|
|
@end
|