学习了这篇文章 架构篇-谈谈如何写个人中心这类页面(静态tableView页面的编写)
给自己的学习做个记录。
根据自己的理解重写了一部分代码。
- WynStaticCell.h
#import "WynBaseCell.h"
@class BaseCellDescriber;
@interface WynBaseStaticCell : WynBaseCell
@property (nonatomic, strong) BaseCellDescriber *describer;
@end
static NSString * const kUITableViewCell = @"WynBaseStaticCell";
static NSString * const kBaseCell = @"WynBaseStaticCell";
typedef void (^CustomCellBlock)(WynBaseStaticCell *cell, BaseCellDescriber *describer);
@interface BaseCellDescriber : NSObject
/**
判断Cell 由代码还是xib创建 */
@property (nonatomic, assign) CellCreationType cellCreationType;
@property (nonatomic, copy) NSString *identifier;
/**
UITableView default value */
@property (nonatomic, copy) NSString *textLabel_text;
@property (nonatomic, strong) UIFont *textLabel_font;
@property (nonatomic, strong) UIColor *textLabel_textColor;
@property (nonatomic, copy) NSString *detailTextLabel_text;
@property (nonatomic, strong) UIFont *detailTextLabel_font;
@property (nonatomic, strong) UIColor *detailTextLabel_textColor;
@property (nonatomic, assign) UITableViewCellAccessoryType accessoryType;
/**
Block */
// (可选)在block中对cell赋值
@property (nonatomic, copy) CustomCellBlock customCellBlock;
@property (nonatomic, copy) void(^selectCellBlock)(WynBaseStaticCell *cell, BaseCellDescriber *describer);
- (CGFloat)cellHeight;
- (CustomCellBlock)defaultCustomCellBlock;
@end
- WynStaticCell.m
#import "WynStaticCell.h"
static const CGFloat defaultCellHeight = 44.0;
@implementation WynBaseStaticCell
#pragma mark - Life cycle.
/*
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:sty