Skip to content

Commit

Permalink
去除默认模式
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWicky committed Feb 13, 2021
1 parent 888eb92 commit 2ed5490
Showing 1 changed file with 40 additions and 27 deletions.
67 changes: 40 additions & 27 deletions DWTableViewHelper/DWTableViewHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,29 @@ @interface DWTableViewHelper ()<UITableViewDelegate,UITableViewDataSource,UITabl

@interface DWTableViewHelperModel ()

@property (nonatomic ,assign) BOOL placeHolderAvoidCrashing;

///计算的竖屏行高
@property (nonatomic ,assign) CGFloat calRowHeightV;

///计算的横屏行高
@property (nonatomic ,assign) CGFloat calRowHeightH;

///原始cell选择样式
@property (nonatomic ,assign) NSInteger originalSelectionStyle;

///默认cell类
@property (nonatomic ,copy) NSString * defaultCellClassStr;

///默认cellID
@property (nonatomic ,copy) NSString * defaultCellID;

@property (nonatomic ,strong) UIImage * cellSnap;

@property (nonatomic ,weak) __kindof DWTableViewHelperCell * currentDisplayCell;

@property (nonatomic ,strong) NSIndexPath * currentDisplayIndexPath;

@property (nonatomic ,assign) BOOL placeHolderAvoidCrashing;

@end

@implementation DWTableViewHelper
Expand Down Expand Up @@ -1244,6 +1259,9 @@ -(__kindof DWTableViewHelperCell *)createCellFromModel:(DWTableViewHelperModel *
} else if (self.cellClassStr.length && self.cellID.length) {
cellIDTemp = self.cellID;
aCellClassStr = self.cellClassStr;
} else if (model.defaultCellClassStr.length && model.defaultCellID.length && NSClassFromString(model.defaultCellClassStr)) {
cellIDTemp = model.defaultCellID;
aCellClassStr = model.defaultCellClassStr;
} else {
NSAssert(NO, @"cellClassStr and cellID must be set together at least one time in DWTableViewHelperModel or DWTableViewHelper");
cellIDTemp = PlaceHolderCellModelAvoidCrashingGetter().cellID;
Expand Down Expand Up @@ -1660,27 +1678,8 @@ static inline void handlePlaceHolderView(UIView * placeHolderView,UITableView *
@end


@interface DWTableViewHelperModel ()

///计算的竖屏行高
@property (nonatomic ,assign) CGFloat calRowHeightV;

///计算的横屏行高
@property (nonatomic ,assign) CGFloat calRowHeightH;

///原始cell选择样式
@property (nonatomic ,assign) NSInteger originalSelectionStyle;

///默认cell类
@property (nonatomic ,copy) NSString * defaultCellClassStr;

///默认cellID
@property (nonatomic ,copy) NSString * defaultCellID;

@end

@implementation DWTableViewHelperModel

@synthesize cellRowHeight,useAutoRowHeight,cellEditSelectedIcon,cellEditUnselectedIcon;
@synthesize cellClassStr = _cellClassStr;
@synthesize cellID = _cellID;
Expand Down Expand Up @@ -1714,14 +1713,18 @@ -(void)setNeedsReAutoCalculateRowHeight {
self.calRowHeightV = DWTableViewHelperAutomaticDimensionAndCache;
}

#pragma mark --- setter/getter ---
-(NSString *)cellClassStr {
if (!_cellClassStr) {
return self.defaultCellClassStr;
}
return _cellClassStr;
#pragma mark --- override ---
-(id)forwardingTargetForSelector:(SEL)aSelector {
#if DEBUG
///Debug模式下暴露问题
return nil;
#else
///Release环境下兼容问题
return [DWForwardingTarget forwardingTargetForSelector:aSelector];
#endif
}

#pragma mark --- setter/getter ---
-(void)setCellClassStr:(NSString *)cellClassStr {
if (![_cellClassStr isEqualToString:cellClassStr]) {
_cellClassStr = cellClassStr;
Expand Down Expand Up @@ -1916,6 +1919,16 @@ -(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
return [super hitTest:point withEvent:event];
}

-(id)forwardingTargetForSelector:(SEL)aSelector {
#if DEBUG
///Debug模式下暴露问题
return nil;
#else
///Release环境下兼容问题
return [DWForwardingTarget forwardingTargetForSelector:aSelector];
#endif
}

@end

@implementation DWTableviewHelperPlaceHolderModel
Expand Down

0 comments on commit 2ed5490

Please sign in to comment.