BaseCell

//
// 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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容