BaseCell

作者: 朝前走不停歇 | 来源:发表于2017-10-23 15:40 被阅读0次

//
// BaseCell.m
// HomeDecorate
//
// Created by mac on 16/8/22.
// Copyright © 2016年 eluotuo. All rights reserved.
//

import <UIKit/UIKit.h>

@interface BaseCell : UITableViewCell

/**
快速创建cell

@param tableView 关联表格
@return cell
/
+(instancetype)cellForTableView:(UITableView
)tableView;

/**
快速创建cell

@param tableView 关联表格
@param identifier 标示位
@param style 展示类型
@return cell
/
+(instancetype)cellForTableView:(UITableView
)tableView Identifier:(NSString*)identifier style:(UITableViewCellStyle)style;

/**
设置视图
*/
-(void)hd_setupSubviews NS_REQUIRES_SUPER;

@end

//
// BaseCell.m
// HomeDecorate
//
// Created by mac on 16/8/22.
// Copyright © 2016年 eluotuo. All rights reserved.
//

import "BaseCell.h"

@implementation BaseCell

  • (NSString *)cellReuseIdentifier{
    return NSStringFromClass([self class]);
    }

+(instancetype)cellForTableView:(UITableView)tableView{
return [self cellForTableView:tableView Identifier:[self cellReuseIdentifier] style:UITableViewCellStyleDefault];
}
+(instancetype)cellForTableView:(UITableView
)tableView Identifier:(NSString*)identifier style:(UITableViewCellStyle)style {

BaseCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
 
if (!cell) {
    
    cell = [[self alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
    
    cell.backgroundColor = [UIColor whiteColor];
    
    cell.clipsToBounds = YES;
    
    [cell.imageView sizeToFit];
     
}
return cell;

}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self hd_setupSubviews];
}
return self;
}

-(void)hd_setupSubviews{}

@end

相关文章

  • BaseCell

    //// BaseCell.m// HomeDecorate//// Created by mac on 1...

  • cell自适应

    @implemation BaseCell + (CGFloat)calcCellHeight:(id)data ...

网友评论

      本文标题:BaseCell

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