Skip to content

Commit 8451842

Browse files
committed
demo
1 parent 32c6771 commit 8451842

7 files changed

Lines changed: 34 additions & 32 deletions

File tree

Example/Example.xcodeproj/project.pbxproj

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
0504E94424AB124000DAC823 /* BMFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0504E92924AB124000DAC823 /* BMFooterView.m */; };
2929
0504E94524AB124000DAC823 /* BMCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0504E92C24AB124000DAC823 /* BMCell.xib */; };
3030
0504E94624AB124000DAC823 /* BMCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0504E92D24AB124000DAC823 /* BMCell.m */; };
31-
0504E94724AB124000DAC823 /* SwiftTestVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0504E93024AB124000DAC823 /* SwiftTestVC.swift */; };
32-
0504E94824AB124000DAC823 /* SwiftTestVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0504E93124AB124000DAC823 /* SwiftTestVC.xib */; };
33-
0504E94924AB124000DAC823 /* SwiftTestCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0504E93424AB124000DAC823 /* SwiftTestCell.swift */; };
34-
0504E94A24AB124000DAC823 /* SwiftTestCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0504E93524AB124000DAC823 /* SwiftTestCell.xib */; };
31+
0504E94724AB124000DAC823 /* XibVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0504E93024AB124000DAC823 /* XibVC.swift */; };
32+
0504E94824AB124000DAC823 /* XibVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0504E93124AB124000DAC823 /* XibVC.xib */; };
33+
0504E94924AB124000DAC823 /* XibCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0504E93424AB124000DAC823 /* XibCell.swift */; };
34+
0504E94A24AB124000DAC823 /* XibCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0504E93524AB124000DAC823 /* XibCell.xib */; };
3535
0504E96C24AB124E00DAC823 /* 8.png in Resources */ = {isa = PBXBuildFile; fileRef = 0504E94D24AB124E00DAC823 /* 8.png */; };
3636
0504E96D24AB124E00DAC823 /* 9.png in Resources */ = {isa = PBXBuildFile; fileRef = 0504E94E24AB124E00DAC823 /* 9.png */; };
3737
0504E96E24AB124E00DAC823 /* 14.png in Resources */ = {isa = PBXBuildFile; fileRef = 0504E94F24AB124E00DAC823 /* 14.png */; };
@@ -116,10 +116,10 @@
116116
0504E92B24AB124000DAC823 /* BMCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMCell.h; sourceTree = "<group>"; };
117117
0504E92C24AB124000DAC823 /* BMCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BMCell.xib; sourceTree = "<group>"; };
118118
0504E92D24AB124000DAC823 /* BMCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMCell.m; sourceTree = "<group>"; };
119-
0504E93024AB124000DAC823 /* SwiftTestVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftTestVC.swift; sourceTree = "<group>"; };
120-
0504E93124AB124000DAC823 /* SwiftTestVC.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SwiftTestVC.xib; sourceTree = "<group>"; };
121-
0504E93424AB124000DAC823 /* SwiftTestCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftTestCell.swift; sourceTree = "<group>"; };
122-
0504E93524AB124000DAC823 /* SwiftTestCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SwiftTestCell.xib; sourceTree = "<group>"; };
119+
0504E93024AB124000DAC823 /* XibVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XibVC.swift; sourceTree = "<group>"; };
120+
0504E93124AB124000DAC823 /* XibVC.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = XibVC.xib; sourceTree = "<group>"; };
121+
0504E93424AB124000DAC823 /* XibCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XibCell.swift; sourceTree = "<group>"; };
122+
0504E93524AB124000DAC823 /* XibCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = XibCell.xib; sourceTree = "<group>"; };
123123
0504E94D24AB124E00DAC823 /* 8.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 8.png; sourceTree = "<group>"; };
124124
0504E94E24AB124E00DAC823 /* 9.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 9.png; sourceTree = "<group>"; };
125125
0504E94F24AB124E00DAC823 /* 14.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 14.png; sourceTree = "<group>"; };
@@ -383,7 +383,7 @@
383383
0504E92E24AB124000DAC823 /* Swift */ = {
384384
isa = PBXGroup;
385385
children = (
386-
05220E9E24AB2AD800D6FAFD /* XIB */,
386+
05220E9E24AB2AD800D6FAFD /* Xib */,
387387
05220E9D24AB2ACD00D6FAFD /* 纯代码 */,
388388
);
389389
path = Swift;
@@ -392,17 +392,17 @@
392392
0504E92F24AB124000DAC823 /* Controller */ = {
393393
isa = PBXGroup;
394394
children = (
395-
0504E93024AB124000DAC823 /* SwiftTestVC.swift */,
396-
0504E93124AB124000DAC823 /* SwiftTestVC.xib */,
395+
0504E93024AB124000DAC823 /* XibVC.swift */,
396+
0504E93124AB124000DAC823 /* XibVC.xib */,
397397
);
398398
path = Controller;
399399
sourceTree = "<group>";
400400
};
401401
0504E93324AB124000DAC823 /* View */ = {
402402
isa = PBXGroup;
403403
children = (
404-
0504E93424AB124000DAC823 /* SwiftTestCell.swift */,
405-
0504E93524AB124000DAC823 /* SwiftTestCell.xib */,
404+
0504E93424AB124000DAC823 /* XibCell.swift */,
405+
0504E93524AB124000DAC823 /* XibCell.xib */,
406406
);
407407
path = View;
408408
sourceTree = "<group>";
@@ -469,13 +469,13 @@
469469
path = "纯代码";
470470
sourceTree = "<group>";
471471
};
472-
05220E9E24AB2AD800D6FAFD /* XIB */ = {
472+
05220E9E24AB2AD800D6FAFD /* Xib */ = {
473473
isa = PBXGroup;
474474
children = (
475475
0504E92F24AB124000DAC823 /* Controller */,
476476
0504E93324AB124000DAC823 /* View */,
477477
);
478-
path = XIB;
478+
path = Xib;
479479
sourceTree = "<group>";
480480
};
481481
7224759EBAD09408C54B3EE0 /* Frameworks */ = {
@@ -609,11 +609,11 @@
609609
0504E97F24AB124E00DAC823 /* 30.png in Resources */,
610610
0504E97A24AB124E00DAC823 /* 22.png in Resources */,
611611
0504E97224AB124E00DAC823 /* 17.png in Resources */,
612-
0504E94824AB124000DAC823 /* SwiftTestVC.xib in Resources */,
612+
0504E94824AB124000DAC823 /* XibVC.xib in Resources */,
613613
0504E96C24AB124E00DAC823 /* 8.png in Resources */,
614614
0504E97E24AB124E00DAC823 /* 18.png in Resources */,
615615
0504E8E224AB120700DAC823 /* Assets.xcassets in Resources */,
616-
0504E94A24AB124000DAC823 /* SwiftTestCell.xib in Resources */,
616+
0504E94A24AB124000DAC823 /* XibCell.xib in Resources */,
617617
0504E98824AB124E00DAC823 /* 1.png in Resources */,
618618
);
619619
runOnlyForDeploymentPostprocessing = 0;
@@ -667,10 +667,10 @@
667667
0504E93824AB124000DAC823 /* main.m in Sources */,
668668
0504E93D24AB124000DAC823 /* BMHomeVC.m in Sources */,
669669
0504E8E024AB120400DAC823 /* Example.xcdatamodeld in Sources */,
670-
0504E94724AB124000DAC823 /* SwiftTestVC.swift in Sources */,
670+
0504E94724AB124000DAC823 /* XibVC.swift in Sources */,
671671
0504E93924AB124000DAC823 /* AppDelegate.m in Sources */,
672672
0504E93A24AB124000DAC823 /* BMHomeVC+BMSectionTest.m in Sources */,
673-
0504E94924AB124000DAC823 /* SwiftTestCell.swift in Sources */,
673+
0504E94924AB124000DAC823 /* XibCell.swift in Sources */,
674674
0504E94124AB124000DAC823 /* BMHeaderView.m in Sources */,
675675
0504E93B24AB124000DAC823 /* BMHomeVC+IndexPaths.m in Sources */,
676676
0504E94024AB124000DAC823 /* BMGroupModel.m in Sources */,

Example/Example/Classes/OC/Controller/BMHomeVC.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSIntege
140140
- (void)swiftButtonClick {
141141
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleAlert];
142142
[alertVC addAction:[UIAlertAction actionWithTitle:@"Swift XIB" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
143-
[self.navigationController pushViewController:SwiftTestVC.new animated:YES];
143+
[self.navigationController pushViewController:XibVC.new animated:YES];
144144
}]];
145145
[alertVC addAction:[UIAlertAction actionWithTitle:@"纯代码" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
146146
[self.navigationController pushViewController:PureCodeVC.new animated:YES];

Example/Example/Classes/Swift/XIB/Controller/SwiftTestVC.swift renamed to Example/Example/Classes/Swift/Xib/Controller/XibVC.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222

2323
import UIKit
2424

25-
class SwiftTestVC: UIViewController {
26-
lazy var dataSourceArray: [String] = {
25+
26+
class XibVC: UIViewController {
27+
fileprivate lazy var dataSourceArray: [String] = {
2728
var arr = [String]()
2829
for i in 0..<30 {
2930
var str = ""
3031
var arc = arc4random_uniform(20) + 1
3132
while arc > 0 {
32-
str.append("我的内容")
33+
str.append("我是内容")
3334
arc -= 1
3435
}
3536
arr.append(str)
@@ -42,13 +43,13 @@ class SwiftTestVC: UIViewController {
4243
}
4344
}
4445

45-
extension SwiftTestVC: UITableViewDataSource, UITableViewDelegate {
46+
extension XibVC: UITableViewDataSource, UITableViewDelegate {
4647
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
4748
dataSourceArray.count
4849
}
4950

5051
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
51-
let cell = SwiftTestCell.bm_tableViewCellFromNib(with: tableView)
52+
let cell = XibCell.bm_tableViewCellFromNib(with: tableView)
5253
if let cell1 = cell {
5354
cell1.desc = dataSourceArray[indexPath.row]
5455
return cell1
@@ -57,8 +58,8 @@ extension SwiftTestVC: UITableViewDataSource, UITableViewDelegate {
5758
}
5859

5960
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
60-
return tableView.bm_height(withCellClass: SwiftTestCell.self, cacheBy: indexPath) { (cell) in
61-
if let cell1 = cell as? SwiftTestCell {
61+
return tableView.bm_height(withCellClass: XibCell.self, cacheBy: indexPath) { (cell) in
62+
if let cell1 = cell as? XibCell {
6263
cell1.desc = self.dataSourceArray[indexPath.row]
6364
}
6465
}

Example/Example/Classes/Swift/XIB/Controller/SwiftTestVC.xib renamed to Example/Example/Classes/Swift/Xib/Controller/XibVC.xib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99
</dependencies>
1010
<objects>
11-
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SwiftTestVC" customModule="Example" customModuleProvider="target">
11+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="XibVC" customModule="Example" customModuleProvider="target">
1212
<connections>
1313
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
1414
</connections>
@@ -19,7 +19,7 @@
1919
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2020
<subviews>
2121
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="toh-06-tGV">
22-
<rect key="frame" x="0.0" y="44" width="414" height="818"/>
22+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
2323
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
2424
<connections>
2525
<outlet property="dataSource" destination="-1" id="0vR-dG-Nvf"/>

Example/Example/Classes/Swift/XIB/View/SwiftTestCell.swift renamed to Example/Example/Classes/Swift/Xib/View/XibCell.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import UIKit
2424

25-
class SwiftTestCell: UITableViewCell {
25+
class XibCell: UITableViewCell {
2626
@IBOutlet weak var descLabel: UILabel!
2727
var desc: String? {
2828
get {
@@ -34,6 +34,7 @@ class SwiftTestCell: UITableViewCell {
3434
}
3535

3636
override func awakeFromNib() {
37+
super.awakeFromNib()
3738
descLabel.superview?.layer.cornerRadius = 5
3839
}
3940
}

Example/Example/Classes/Swift/XIB/View/SwiftTestCell.xib renamed to Example/Example/Classes/Swift/Xib/View/XibCell.xib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<objects>
1111
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
1212
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
13-
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="203" id="KGk-i7-Jjw" customClass="SwiftTestCell" customModule="Example" customModuleProvider="target">
13+
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="203" id="KGk-i7-Jjw" customClass="XibCell" customModule="Example" customModuleProvider="target">
1414
<rect key="frame" x="0.0" y="0.0" width="372" height="203"/>
1515
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
1616
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">

Example/Example/Classes/Swift/纯代码/PureCodeVC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import UIKit
1111

1212
class PureCodeVC: UIViewController {
1313
lazy var tableView: UITableView = {
14-
let tableView = UITableView.init(frame: .zero, style: .plain)
14+
let tableView = UITableView(frame: .zero, style: .plain)
1515
tableView.delegate = self
1616
tableView.dataSource = self
1717
tableView.separatorStyle = .none

0 commit comments

Comments
 (0)