Skip to content

Commit a4293cc

Browse files
committed
update: FullScreenable - 调整Demo
1 parent f640978 commit a4293cc

File tree

8 files changed

+124
-12
lines changed

8 files changed

+124
-12
lines changed

Example/LXFProtocolTool.xcodeproj/project.pbxproj

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
FD62EE622077CD82002C1B53 /* LXFXibTestView.xib in Resources */ = {isa = PBXBuildFile; fileRef = FD62EE602077CD82002C1B53 /* LXFXibTestView.xib */; };
3232
FD62EE632077CD82002C1B53 /* LXFXibTestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD62EE612077CD82002C1B53 /* LXFXibTestView.swift */; };
3333
FD62EE682077D620002C1B53 /* LXFEmptyDemoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD62EE672077D620002C1B53 /* LXFEmptyDemoController.swift */; };
34+
FD75175526D0AB4D000B0E2B /* LXFFullScreenableViewAutoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD75175426D0AB4D000B0E2B /* LXFFullScreenableViewAutoController.swift */; };
3435
FD97E0DD214B4A030057C3C1 /* LXFFullScreenableController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD97E0DC214B4A030057C3C1 /* LXFFullScreenableController.swift */; };
3536
FD97E0DF214B5CFE0057C3C1 /* LXFFullScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD97E0DE214B5CFE0057C3C1 /* LXFFullScreenView.swift */; };
3637
FD9E556A2261F88A00921471 /* LXFDIYHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9E55692261F88A00921471 /* LXFDIYHeader.swift */; };
@@ -88,6 +89,7 @@
8889
FD62EE602077CD82002C1B53 /* LXFXibTestView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LXFXibTestView.xib; sourceTree = "<group>"; };
8990
FD62EE612077CD82002C1B53 /* LXFXibTestView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LXFXibTestView.swift; sourceTree = "<group>"; };
9091
FD62EE672077D620002C1B53 /* LXFEmptyDemoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFEmptyDemoController.swift; sourceTree = "<group>"; };
92+
FD75175426D0AB4D000B0E2B /* LXFFullScreenableViewAutoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFFullScreenableViewAutoController.swift; sourceTree = "<group>"; };
9193
FD97E0DC214B4A030057C3C1 /* LXFFullScreenableController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFFullScreenableController.swift; sourceTree = "<group>"; };
9294
FD97E0DE214B5CFE0057C3C1 /* LXFFullScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFFullScreenView.swift; sourceTree = "<group>"; };
9395
FD9E55692261F88A00921471 /* LXFDIYHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFDIYHeader.swift; sourceTree = "<group>"; };
@@ -297,14 +299,39 @@
297299
path = LXFEmptyDataSetable;
298300
sourceTree = "<group>";
299301
};
300-
FD97E0D9214B48990057C3C1 /* LXFFullScreenable */ = {
302+
FD75175126D0AAF3000B0E2B /* MultiVc */ = {
301303
isa = PBXGroup;
302304
children = (
303-
FD97E0DC214B4A030057C3C1 /* LXFFullScreenableController.swift */,
304305
BD1DA347254BBFF500C99438 /* LXFFullScreenableMultiVcController.swift */,
306+
BD1DA349254BC06C00C99438 /* LXFFullScreenableOtherController.swift */,
307+
);
308+
path = MultiVc;
309+
sourceTree = "<group>";
310+
};
311+
FD75175226D0AAFF000B0E2B /* Manual */ = {
312+
isa = PBXGroup;
313+
children = (
314+
FD97E0DC214B4A030057C3C1 /* LXFFullScreenableController.swift */,
305315
FD97E0DE214B5CFE0057C3C1 /* LXFFullScreenView.swift */,
316+
);
317+
path = Manual;
318+
sourceTree = "<group>";
319+
};
320+
FD75175326D0AB27000B0E2B /* ViewAuto */ = {
321+
isa = PBXGroup;
322+
children = (
306323
FD1D4DE723063F2400C5E359 /* LXFFullSwitchView.swift */,
307-
BD1DA349254BC06C00C99438 /* LXFFullScreenableOtherController.swift */,
324+
FD75175426D0AB4D000B0E2B /* LXFFullScreenableViewAutoController.swift */,
325+
);
326+
path = ViewAuto;
327+
sourceTree = "<group>";
328+
};
329+
FD97E0D9214B48990057C3C1 /* LXFFullScreenable */ = {
330+
isa = PBXGroup;
331+
children = (
332+
FD75175326D0AB27000B0E2B /* ViewAuto */,
333+
FD75175226D0AAFF000B0E2B /* Manual */,
334+
FD75175126D0AAF3000B0E2B /* MultiVc */,
308335
);
309336
path = LXFFullScreenable;
310337
sourceTree = "<group>";
@@ -571,6 +598,7 @@
571598
BD1DA348254BBFF500C99438 /* LXFFullScreenableMultiVcController.swift in Sources */,
572599
FD5152A62111919700A8591F /* LXFRefreshableReactor.swift in Sources */,
573600
FDCE664B26A2D9D500B49BE3 /* LXFRefreshableTrailerReactor.swift in Sources */,
601+
FD75175526D0AB4D000B0E2B /* LXFFullScreenableViewAutoController.swift in Sources */,
574602
FD62EE632077CD82002C1B53 /* LXFXibTestView.swift in Sources */,
575603
FD1FCB2E21A5509800302EDD /* Configs.swift in Sources */,
576604
);

Example/LXFProtocolTool/Demo/LXFFullScreenable/LXFFullScreenView.swift renamed to Example/LXFProtocolTool/Demo/LXFFullScreenable/Manual/LXFFullScreenView.swift

File renamed without changes.

Example/LXFProtocolTool/Demo/LXFFullScreenable/LXFFullScreenableController.swift renamed to Example/LXFProtocolTool/Demo/LXFFullScreenable/Manual/LXFFullScreenableController.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ class LXFFullScreenableController: UIViewController, FullScreenable {
2828
return v
2929
}()
3030

31-
fileprivate lazy var switchView: LXFFullSwitchView = {
32-
let v = LXFFullSwitchView(.custom)
33-
v.frame = CGRect(x: 50, y: 400, width: 200, height: 100)
34-
v.setTitle("switch full screen", for: .normal)
35-
v.setTitleColor(.black, for: .normal)
36-
return v
37-
}()
38-
3931
fileprivate lazy var diyConfig: FullScreenableConfig = {
4032
return FullScreenableConfig(
4133
animateDuration: 1,
@@ -55,7 +47,6 @@ class LXFFullScreenableController: UIViewController, FullScreenable {
5547
self.view.backgroundColor = .white
5648
self.view.addSubview(redView)
5749
self.view.addSubview(cyanView)
58-
self.view.addSubview(switchView)
5950

6051
redView.addTarget(self, action: #selector(redViewClick), for: .touchUpInside)
6152

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//
2+
// LXFFullScreenableMultiVcController.swift
3+
// LXFProtocolTool_Example
4+
//
5+
// Created by LinXunFeng on 2020/10/30.
6+
// Copyright © 2020 CocoaPods. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import LXFProtocolTool
11+
12+
class LXFFullScreenableMultiVcController: UIViewController, FullScreenable {
13+
14+
fileprivate let contentView = UIView().then {
15+
$0.backgroundColor = .orange
16+
}
17+
fileprivate let otherVc = LXFFullScreenableOtherController()
18+
19+
override func viewDidLoad() {
20+
super.viewDidLoad()
21+
22+
initUI()
23+
lxf.autoFullScreen(specifiedView: contentView, superView: view)
24+
25+
// 前提: autoFullScreen在任意地方被执行一次后
26+
// 在当前控制器下添加了子控制器时,旋转控制权就会变得很混乱,这时候需要声明谁拥有全屏旋转控制权
27+
28+
// 步骤:
29+
// 1. 在当前控制器的viewWillAppear指定哪个控制器(简称: vcA)拥有控制权,
30+
// 2. 且在viewWillDisappear中注销vcA的控制权
31+
}
32+
33+
deinit {
34+
print("deinit -- LXFFullScreenableMultiVcController")
35+
}
36+
37+
override func viewWillAppear(_ animated: Bool) {
38+
super.viewWillAppear(animated)
39+
// 指定当前控制器拥有控制权
40+
lxf.becomeFullScreenMaster()
41+
}
42+
43+
override func viewWillDisappear(_ animated: Bool) {
44+
super.viewWillDisappear(animated)
45+
// 注销当前控制器的控制权
46+
lxf.resignFullScreenMaster()
47+
}
48+
49+
fileprivate func initUI() {
50+
self.view.backgroundColor = .white
51+
self.view.addSubview(contentView)
52+
contentView.addSubview(otherVc.view)
53+
contentView.frame = CGRect(x: 50, y: 80, width: 100, height: 100)
54+
otherVc.view.frame = contentView.bounds
55+
}
56+
57+
}

Example/LXFProtocolTool/Demo/LXFFullScreenable/LXFFullScreenableOtherController.swift renamed to Example/LXFProtocolTool/Demo/LXFFullScreenable/MultiVc/LXFFullScreenableOtherController.swift

File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// LXFFullScreenableViewAutoController.swift
3+
// LXFProtocolTool_Example
4+
//
5+
// Created by LinXunFeng on 2021/8/21.
6+
// Copyright © 2021 CocoaPods. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import LXFProtocolTool
11+
12+
class LXFFullScreenableViewAutoController: UIViewController, FullScreenable {
13+
14+
fileprivate lazy var switchView: LXFFullSwitchView = {
15+
let v = LXFFullSwitchView(.custom)
16+
v.frame = CGRect(x: 50, y: 100, width: 200, height: 100)
17+
v.setTitle("switch full screen", for: .normal)
18+
v.setTitleColor(.black, for: .normal)
19+
return v
20+
}()
21+
22+
override func viewDidLoad() {
23+
super.viewDidLoad()
24+
25+
self.view.backgroundColor = .white
26+
self.view.addSubview(switchView)
27+
}
28+
29+
deinit {
30+
print("deinit -- LXFFullScreenableViewAutoController")
31+
}
32+
}

Example/LXFProtocolTool/Demo/LXFFullScreenable/LXFFullSwitchView.swift renamed to Example/LXFProtocolTool/Demo/LXFFullScreenable/ViewAuto/LXFFullSwitchView.swift

File renamed without changes.

Example/LXFProtocolTool/ViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum LXFListOptionType: String {
1616
case refreshableTrailer = "Refreshable-左滑"
1717
case refreshableMutiple = "Refreshable-多个列表"
1818
case fullScreenable = "FullScreenable"
19+
case fullScreenableViewAuto = "fullScreenableViewAuto"
1920
case fullScreenableMultiVc = "FullScreenable-multiVc"
2021
}
2122

@@ -28,6 +29,7 @@ class ViewController: UIViewController, FullScreenable {
2829
.refreshableTrailer,
2930
.refreshableMutiple,
3031
.fullScreenable,
32+
.fullScreenableViewAuto,
3133
.fullScreenableMultiVc
3234
]
3335

@@ -83,6 +85,8 @@ extension ViewController: UITableViewDataSource, UITableViewDelegate {
8385
vc = LXFRefreshRespectiveController(reactor: LXFRefreshRespectiveReactor())
8486
case .fullScreenable:
8587
vc = LXFFullScreenableController()
88+
case .fullScreenableViewAuto:
89+
vc = LXFFullScreenableViewAutoController()
8690
case .fullScreenableMultiVc:
8791
vc = LXFFullScreenableMultiVcController()
8892
}

0 commit comments

Comments
 (0)