美文网首页
6.29 学习方法

6.29 学习方法

作者: 小码农杰哥 | 来源:发表于2017-06-29 23:10 被阅读0次

    //自定义cell的方法

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    MyVoucherCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];

    if (cell == nil) {

    cell = [[[NSBundle mainBundle]loadNibNamed:NSStringFromClass([MyVoucherCell class]) owner:self options:nil] lastObject];

    cell.backgroundColor = [UIColor clearColor];

    UIImageView *imageView = [self pastImageView];     //调用三次

    [cell.backImageView addSubview:imageView];

    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {

    make.top.mas_equalTo(cell.backImageView.mas_top).offset(18);

    make.right.mas_equalTo(cell.backImageView.mas_right).offset(-75);

    make.bottom.mas_equalTo(cell.backImageView.mas_bottom).offset(-17.5);

    }];

    cell.storeLabel.textColor = [UIColor colorWithHexString:@"9c9c9c"];

    cell.limitLabel.textColor = [UIColor colorWithHexString:@"9c9c9c"];

    cell.enableLabel.textColor = [UIColor colorWithHexString:@"9c9c9c"];

    cell.unitLabel.textColor = [UIColor colorWithHexString:@"9c9c9c"];

    cell.priceLabel.textColor = [UIColor colorWithHexString:@"9c9c9c"];

    cell.fullLabel.textColor = [UIColor colorWithHexString:@"9c9c9c"];

    cell.selectionStyle = UITableViewCellSelectionStyleNone; //去掉点击效果

    }

    return cell;

    }

    -(UIImageView *)pastImageView{

    _pastImageView = [[UIImageView alloc]init];

    _pastImageView.image = [UIImage imageNamed:@"已过期"];

    return _pastImageView;

    不能用 if( nil == _pastImageView);  防止重复创建一个对象,比拟单例

    }

    相关文章

      网友评论

          本文标题:6.29 学习方法

          本文链接:https://www.haomeiwen.com/subject/zlovcxtx.html