123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- //
- // HomeSchoolCell.m
- // smartRhino
- //
- // Created by niuzhen on 2020/5/16.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "HomeSchoolCell.h"
- @implementation HomeSchoolCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- self.addressL.layer.cornerRadius = 2.f;
- self.addressL.layer.masksToBounds = YES;
- self.addressL.backgroundColor = UIColorHex(0xF4F4F4);
- self.numL.layer.cornerRadius = 2.f;
- self.numL.layer.masksToBounds = YES;
- self.numL.backgroundColor = UIColorHex(0xF4F4F4);
- self.levelL.layer.cornerRadius = 2.f;
- self.levelL.layer.masksToBounds = YES;
- self.levelL.backgroundColor = UIColorHex(0xF4F4F4);
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- + (HomeSchoolCell *)configCell:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
- static NSString *cellIdentifer = @"HomeSchoolCell";
- HomeSchoolCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
- if (cell == nil) {
- cell = [[[NSBundle mainBundle] loadNibNamed:@"HomeSchoolCell" owner:nil options:nil] objectAtIndex:0];
- }
- return cell;
- }
- - (void)setData
- {
- self.addressL.text = @"北京";
- self.numL.text = @"特级教师36人";
- self.levelL.text = @"小学、初中";
- self.addW.constant = [self addPlaceLabel:self.addressL];
- self.numW.constant = [self addPlaceLabel:self.numL];
- self.levelW.constant = [self addPlaceLabel:self.levelL];
- }
- - (CGFloat)addPlaceLabel:(UILabel *)label
- {
- CGFloat W = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 18)].width + 16;
- return W;
- }
- @end
|