Skip to content

Commit df49cf5

Browse files
committed
增加断言
1 parent 28be1e5 commit df49cf5

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

Sources/UITableViewDynamicLayoutCacheHeight/UITableViewCell+BMDynamicLayout.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ + (instancetype)bm_tableViewCellFromNibWithTableView:(UITableView *)tableView {
4141
return cell;
4242
}
4343
NSBundle *bundle = [NSBundle bundleForClass:self.class];
44+
NSString *path = [bundle pathForResource:selfClassName ofType:@"nib"];
45+
if (path.length == 0) {
46+
NSAssert(NO, @"你的 Cell 不是 IB 创建的");
47+
return nil;
48+
}
49+
4450
NSArray <UITableViewCell *> *arr = [bundle loadNibNamed:selfClassName owner:nil options:nil];
4551
for (UITableViewCell *obj in arr) {
4652
if ([obj isMemberOfClass:self.class]) {

Sources/UITableViewDynamicLayoutCacheHeight/UITableViewHeaderFooterView+BMDynamicLayout.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ + (instancetype)bm_tableViewHeaderFooterViewFromNibWithTableView:(UITableView *)
4141
return headerFooterView;
4242
}
4343
NSBundle *bundle = [NSBundle bundleForClass:self.class];
44+
NSString *path = [bundle pathForResource:selfClassName ofType:@"nib"];
45+
if (path.length == 0) {
46+
NSAssert(NO, @"你的 UITableViewHeaderFooterView 不是 IB 创建的");
47+
return nil;
48+
}
4449
NSArray <UITableViewHeaderFooterView *> *arr = [bundle loadNibNamed:selfClassName owner:nil options:nil];
4550
for (UITableViewHeaderFooterView *obj in arr) {
4651
if ([obj isMemberOfClass:self.class]) {

UITableViewDynamicLayoutCacheHeight.xcodeproj/project.pbxproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 51;
6+
objectVersion = 50;
77
objects = {
88

99
/* Begin PBXBuildFile section */
1010
0429DAB3247AD23800995106 /* BMHomeVC+BMTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0429DAB2247AD23800995106 /* BMHomeVC+BMTest.m */; };
11+
04330124249121C300202B9E /* UIFooterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04330123249121C300202B9E /* UIFooterView.xib */; };
12+
04330126249121DF00202B9E /* BMCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04330125249121DF00202B9E /* BMCell.xib */; };
1113
04462C312470346A00591742 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04462C302470346A00591742 /* Assets.xcassets */; };
1214
04462C412470346A00591742 /* UITableViewDynamicLayoutCacheHeightTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 04462C402470346A00591742 /* UITableViewDynamicLayoutCacheHeightTests.m */; };
1315
04462C4C2470346A00591742 /* UITableViewDynamicLayoutCacheHeightUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 04462C4B2470346A00591742 /* UITableViewDynamicLayoutCacheHeightUITests.m */; };
1416
04462CA82470356E00591742 /* BMHomeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 04462C622470356D00591742 /* BMHomeVC.m */; };
1517
04462CA92470356E00591742 /* BMHomeVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04462C632470356D00591742 /* BMHomeVC.xib */; };
1618
04462CAA2470356E00591742 /* BMModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 04462C672470356D00591742 /* BMModel.m */; };
1719
04462CAB2470356E00591742 /* BMGroupModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 04462C6B2470356D00591742 /* BMGroupModel.m */; };
18-
04462CAC2470356E00591742 /* UIFooterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04462C6F2470356D00591742 /* UIFooterView.xib */; };
1920
04462CAD2470356E00591742 /* UIFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04462C702470356D00591742 /* UIFooterView.m */; };
2021
04462CAE2470356E00591742 /* BMHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04462C722470356D00591742 /* BMHeaderView.m */; };
2122
04462CAF2470356E00591742 /* BMHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04462C732470356D00591742 /* BMHeaderView.xib */; };
22-
04462CB02470356E00591742 /* BMCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04462C772470356D00591742 /* BMCell.xib */; };
2323
04462CB12470356E00591742 /* BMCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 04462C782470356D00591742 /* BMCell.m */; };
2424
04462CB22470356E00591742 /* 8.png in Resources */ = {isa = PBXBuildFile; fileRef = 04462C7B2470356E00591742 /* 8.png */; };
2525
04462CB32470356E00591742 /* 9.png in Resources */ = {isa = PBXBuildFile; fileRef = 04462C7C2470356E00591742 /* 9.png */; };
@@ -91,6 +91,8 @@
9191
/* Begin PBXFileReference section */
9292
0429DAB1247AD23800995106 /* BMHomeVC+BMTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "BMHomeVC+BMTest.h"; sourceTree = "<group>"; };
9393
0429DAB2247AD23800995106 /* BMHomeVC+BMTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "BMHomeVC+BMTest.m"; sourceTree = "<group>"; };
94+
04330123249121C300202B9E /* UIFooterView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIFooterView.xib; sourceTree = "<group>"; };
95+
04330125249121DF00202B9E /* BMCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BMCell.xib; sourceTree = "<group>"; };
9496
04462C212470346800591742 /* CellCacheHeight.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CellCacheHeight.app; sourceTree = BUILT_PRODUCTS_DIR; };
9597
04462C302470346A00591742 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
9698
04462C352470346A00591742 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -108,13 +110,11 @@
108110
04462C6A2470356D00591742 /* BMGroupModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMGroupModel.h; sourceTree = "<group>"; };
109111
04462C6B2470356D00591742 /* BMGroupModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMGroupModel.m; sourceTree = "<group>"; };
110112
04462C6E2470356D00591742 /* UIFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIFooterView.h; sourceTree = "<group>"; };
111-
04462C6F2470356D00591742 /* UIFooterView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIFooterView.xib; sourceTree = "<group>"; };
112113
04462C702470356D00591742 /* UIFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIFooterView.m; sourceTree = "<group>"; };
113114
04462C722470356D00591742 /* BMHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMHeaderView.m; sourceTree = "<group>"; };
114115
04462C732470356D00591742 /* BMHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BMHeaderView.xib; sourceTree = "<group>"; };
115116
04462C742470356D00591742 /* BMHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMHeaderView.h; sourceTree = "<group>"; };
116117
04462C762470356D00591742 /* BMCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMCell.h; sourceTree = "<group>"; };
117-
04462C772470356D00591742 /* BMCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BMCell.xib; sourceTree = "<group>"; };
118118
04462C782470356D00591742 /* BMCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMCell.m; sourceTree = "<group>"; };
119119
04462C7B2470356E00591742 /* 8.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 8.png; sourceTree = "<group>"; };
120120
04462C7C2470356E00591742 /* 9.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 9.png; sourceTree = "<group>"; };
@@ -335,8 +335,8 @@
335335
04462C6D2470356D00591742 /* UIFooterView */ = {
336336
isa = PBXGroup;
337337
children = (
338+
04330123249121C300202B9E /* UIFooterView.xib */,
338339
04462C6E2470356D00591742 /* UIFooterView.h */,
339-
04462C6F2470356D00591742 /* UIFooterView.xib */,
340340
04462C702470356D00591742 /* UIFooterView.m */,
341341
);
342342
path = UIFooterView;
@@ -355,8 +355,8 @@
355355
04462C752470356D00591742 /* BMCell */ = {
356356
isa = PBXGroup;
357357
children = (
358+
04330125249121DF00202B9E /* BMCell.xib */,
358359
04462C762470356D00591742 /* BMCell.h */,
359-
04462C772470356D00591742 /* BMCell.xib */,
360360
04462C782470356D00591742 /* BMCell.m */,
361361
);
362362
path = BMCell;
@@ -635,24 +635,24 @@
635635
04462CAF2470356E00591742 /* BMHeaderView.xib in Resources */,
636636
04462CC72470356E00591742 /* 25.png in Resources */,
637637
04462CCC2470356E00591742 /* 6.png in Resources */,
638+
04330126249121DF00202B9E /* BMCell.xib in Resources */,
638639
04462CC62470356E00591742 /* 24.png in Resources */,
639640
04462CC12470356E00591742 /* 23.png in Resources */,
640641
04462CB32470356E00591742 /* 9.png in Resources */,
641642
04462CC22470356E00591742 /* 27.png in Resources */,
642643
04462CC32470356E00591742 /* 26.png in Resources */,
643644
04462CDC247035A700591742 /* UITableViewDynamicLayoutCacheHeight.podspec in Resources */,
644-
04462CAC2470356E00591742 /* UIFooterView.xib in Resources */,
645645
04462CC92470356E00591742 /* 4.png in Resources */,
646646
04462CCA2470356E00591742 /* 5.png in Resources */,
647647
04462CCB2470356E00591742 /* 7.png in Resources */,
648-
04462CB02470356E00591742 /* BMCell.xib in Resources */,
649648
04462CC42470356E00591742 /* 18.png in Resources */,
650649
04462CBC2470356E00591742 /* 11.png in Resources */,
651650
04462CC82470356E00591742 /* 19.png in Resources */,
652651
04462CA92470356E00591742 /* BMHomeVC.xib in Resources */,
653652
04462CD72470359600591742 /* LaunchScreen.storyboard in Resources */,
654653
04462CDE247035A700591742 /* LICENSE in Resources */,
655654
04462CB42470356E00591742 /* 14.png in Resources */,
655+
04330124249121C300202B9E /* UIFooterView.xib in Resources */,
656656
04462C312470346A00591742 /* Assets.xcassets in Resources */,
657657
04462CB72470356E00591742 /* 15.png in Resources */,
658658
04462CD02470356E00591742 /* data.text in Resources */,

0 commit comments

Comments
 (0)