2626#import " UITableViewHeaderFooterView+BMDynamicLayout.h"
2727#import " UITableViewCell+BMDynamicLayout.h"
2828#import " UITableViewDynamicLayoutCacheHeight.h"
29+ #import " UITableView+BMPrivate.h"
2930
3031void tableViewDynamicLayoutLayoutIfNeeded (UIView *view);
3132inline void tableViewDynamicLayoutLayoutIfNeeded (UIView *view) {
@@ -84,11 +85,7 @@ @implementation UITableView (BMDynamicLayout)
8485
8586- (UIView *)_cellViewWithCellClass : (Class )clas {
8687 NSString *cellClassName = NSStringFromClass (clas);
87- // 兼容 Swift
88- if ([cellClassName rangeOfString: @" ." ].location != NSNotFound ) {
89- cellClassName = [cellClassName componentsSeparatedByString: @" ." ].lastObject ;
90- }
91-
88+
9289 NSMutableDictionary *dict = objc_getAssociatedObject (self, _cmd);
9390 if (!dict) {
9491 dict = @{}.mutableCopy ;
@@ -101,10 +98,10 @@ - (UIView *)_cellViewWithCellClass:(Class)clas {
10198 }
10299
103100 NSBundle *bundle = [NSBundle bundleForClass: clas];
104- NSString *path = [bundle pathForResource: cellClassName ofType: @" nib" ];
101+ NSString *path = [bundle pathForResource: kSwiftClassNibName ( cellClassName) ofType: @" nib" ];
105102 UITableViewCell *cell = nil ;
106103 if (path.length > 0 ) {
107- NSArray <UITableViewCell *> *arr = [[UINib nibWithNibName: cellClassName bundle: bundle] instantiateWithOwner: nil options: nil ];
104+ NSArray <UITableViewCell *> *arr = [[UINib nibWithNibName: kSwiftClassNibName ( cellClassName) bundle: bundle] instantiateWithOwner: nil options: nil ];
108105 for (UITableViewCell *obj in arr) {
109106 if ([obj isMemberOfClass: clas]) {
110107 cell = obj;
@@ -175,11 +172,7 @@ - (CGFloat)_heightWithCellClass:(Class)clas
175172- (UIView *)_headerFooterViewWithHeaderFooterViewClass : (Class )clas
176173 sel : (SEL )sel {
177174 NSString *headerFooterViewClassName = NSStringFromClass (clas);
178- // 兼容 Swift
179- if ([headerFooterViewClassName rangeOfString: @" ." ].location != NSNotFound ) {
180- headerFooterViewClassName = [headerFooterViewClassName componentsSeparatedByString: @" ." ].lastObject ;
181- }
182-
175+
183176 NSMutableDictionary *dict = objc_getAssociatedObject (self, sel);
184177 if (!dict) {
185178 dict = @{}.mutableCopy ;
@@ -192,10 +185,10 @@ - (UIView *)_headerFooterViewWithHeaderFooterViewClass:(Class)clas
192185 }
193186
194187 NSBundle *bundle = [NSBundle bundleForClass: clas];
195- NSString *path = [bundle pathForResource: headerFooterViewClassName ofType: @" nib" ];
188+ NSString *path = [bundle pathForResource: kSwiftClassNibName ( headerFooterViewClassName) ofType: @" nib" ];
196189 UIView *headerView = nil ;
197190 if (path.length > 0 ) {
198- NSArray <UITableViewHeaderFooterView *> *arr = [[UINib nibWithNibName: headerFooterViewClassName bundle: bundle] instantiateWithOwner: nil options: nil ];
191+ NSArray <UITableViewHeaderFooterView *> *arr = [[UINib nibWithNibName: kSwiftClassNibName ( headerFooterViewClassName) bundle: bundle] instantiateWithOwner: nil options: nil ];
199192 for (UITableViewHeaderFooterView *obj in arr) {
200193 if ([obj isMemberOfClass: clas]) {
201194 headerView = obj;
0 commit comments