Skip to content

Commit 1b6f2eb

Browse files
committed
update: 调整功能演示代码
1 parent 7373eca commit 1b6f2eb

File tree

4 files changed

+88
-4
lines changed

4 files changed

+88
-4
lines changed

Example/LXFProtocolTool.xcodeproj/project.pbxproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
FD62EE632077CD82002C1B53 /* LXFXibTestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD62EE612077CD82002C1B53 /* LXFXibTestView.swift */; };
3333
FD62EE682077D620002C1B53 /* LXFEmptyDemoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD62EE672077D620002C1B53 /* LXFEmptyDemoController.swift */; };
3434
FD75175526D0AB4D000B0E2B /* LXFFullScreenableViewAutoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD75175426D0AB4D000B0E2B /* LXFFullScreenableViewAutoController.swift */; };
35+
FD75175826D0C6AB000B0E2B /* LXFFullScreenableNestController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD75175726D0C6AB000B0E2B /* LXFFullScreenableNestController.swift */; };
3536
FD97E0DD214B4A030057C3C1 /* LXFFullScreenableController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD97E0DC214B4A030057C3C1 /* LXFFullScreenableController.swift */; };
3637
FD97E0DF214B5CFE0057C3C1 /* LXFFullScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD97E0DE214B5CFE0057C3C1 /* LXFFullScreenView.swift */; };
3738
FD9E556A2261F88A00921471 /* LXFDIYHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9E55692261F88A00921471 /* LXFDIYHeader.swift */; };
@@ -90,6 +91,7 @@
9091
FD62EE612077CD82002C1B53 /* LXFXibTestView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LXFXibTestView.swift; sourceTree = "<group>"; };
9192
FD62EE672077D620002C1B53 /* LXFEmptyDemoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFEmptyDemoController.swift; sourceTree = "<group>"; };
9293
FD75175426D0AB4D000B0E2B /* LXFFullScreenableViewAutoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFFullScreenableViewAutoController.swift; sourceTree = "<group>"; };
94+
FD75175726D0C6AB000B0E2B /* LXFFullScreenableNestController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFFullScreenableNestController.swift; sourceTree = "<group>"; };
9395
FD97E0DC214B4A030057C3C1 /* LXFFullScreenableController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFFullScreenableController.swift; sourceTree = "<group>"; };
9496
FD97E0DE214B5CFE0057C3C1 /* LXFFullScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFFullScreenView.swift; sourceTree = "<group>"; };
9597
FD9E55692261F88A00921471 /* LXFDIYHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFDIYHeader.swift; sourceTree = "<group>"; };
@@ -326,12 +328,21 @@
326328
path = ViewAuto;
327329
sourceTree = "<group>";
328330
};
331+
FD75175626D0C665000B0E2B /* Nest */ = {
332+
isa = PBXGroup;
333+
children = (
334+
FD75175726D0C6AB000B0E2B /* LXFFullScreenableNestController.swift */,
335+
);
336+
path = Nest;
337+
sourceTree = "<group>";
338+
};
329339
FD97E0D9214B48990057C3C1 /* LXFFullScreenable */ = {
330340
isa = PBXGroup;
331341
children = (
332-
FD75175326D0AB27000B0E2B /* ViewAuto */,
333342
FD75175226D0AAFF000B0E2B /* Manual */,
343+
FD75175326D0AB27000B0E2B /* ViewAuto */,
334344
FD75175126D0AAF3000B0E2B /* MultiVc */,
345+
FD75175626D0C665000B0E2B /* Nest */,
335346
);
336347
path = LXFFullScreenable;
337348
sourceTree = "<group>";
@@ -581,6 +592,7 @@
581592
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
582593
FD5152AF21119A7800A8591F /* LXFRefreshableCell.swift in Sources */,
583594
FD62EE682077D620002C1B53 /* LXFEmptyDemoController.swift in Sources */,
595+
FD75175826D0C6AB000B0E2B /* LXFFullScreenableNestController.swift in Sources */,
584596
FDDD69A92111AE2C0069498D /* LXFNibloadableController.swift in Sources */,
585597
FD4A828721916D570064C07E /* LXFRefreshRespectiveReactor.swift in Sources */,
586598
FD9E556C2261FD0B00921471 /* LXFDIYAutoFooter.swift in Sources */,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class LXFFullScreenableOtherController: UIViewController {
1616

1717
override func viewDidLoad() {
1818
super.viewDidLoad()
19+
20+
self.view.backgroundColor = .black.withAlphaComponent(0.2)
1921

2022
self.view.addSubview(redView)
2123
self.redView.frame = CGRect(x: 0, y: 0, width: 50, height: 50)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//
2+
// LXFFullScreenableNestController.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 LXFFullScreenableNestController: 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+
24+
// 在嵌套多层的情况下,需要指定退出全屏时目标容器的frame,否则会很突兀
25+
// lxf.autoFullScreen(specifiedView: self.otherVc.view, superView: contentView)
26+
lxf.autoFullScreen(
27+
specifiedView: self.otherVc.view,
28+
superView: contentView,
29+
exitFullScreenToFrame: contentView.frame
30+
)
31+
32+
33+
// 前提: autoFullScreen在任意地方被执行一次后
34+
// 在当前控制器下添加了子控制器时,旋转控制权就会变得很混乱,这时候需要声明谁拥有全屏旋转控制权
35+
36+
// 步骤:
37+
// 1. 在当前控制器的viewWillAppear指定哪个控制器(简称: vcA)拥有控制权,
38+
// 2. 且在viewWillDisappear中注销vcA的控制权
39+
}
40+
41+
deinit {
42+
print("deinit -- LXFFullScreenableNestController")
43+
}
44+
45+
override func viewWillAppear(_ animated: Bool) {
46+
super.viewWillAppear(animated)
47+
// 指定当前控制器拥有控制权
48+
lxf.becomeFullScreenMaster()
49+
}
50+
51+
override func viewWillDisappear(_ animated: Bool) {
52+
super.viewWillDisappear(animated)
53+
// 注销当前控制器的控制权
54+
lxf.resignFullScreenMaster()
55+
}
56+
57+
fileprivate func initUI() {
58+
self.view.backgroundColor = .white
59+
self.view.addSubview(contentView)
60+
contentView.addSubview(otherVc.view)
61+
contentView.frame = CGRect(x: 50, y: 80, width: 100, height: 100)
62+
otherVc.view.frame = contentView.bounds
63+
}
64+
65+
}
66+

Example/LXFProtocolTool/ViewController.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ enum LXFListOptionType: String {
1616
case refreshableTrailer = "Refreshable-左滑"
1717
case refreshableMutiple = "Refreshable-多个列表"
1818
case fullScreenable = "FullScreenable"
19-
case fullScreenableViewAuto = "fullScreenableViewAuto"
20-
case fullScreenableMultiVc = "FullScreenable-multiVc"
19+
case fullScreenableViewAuto = "fullScreenable-子视图全屏"
20+
case fullScreenableMultiVc = "FullScreenable-多个控制器"
21+
case fullScreenableNest = "FullScreenable-嵌套"
2122
}
2223

2324
class ViewController: UIViewController, FullScreenable {
@@ -30,7 +31,8 @@ class ViewController: UIViewController, FullScreenable {
3031
.refreshableMutiple,
3132
.fullScreenable,
3233
.fullScreenableViewAuto,
33-
.fullScreenableMultiVc
34+
.fullScreenableMultiVc,
35+
.fullScreenableNest
3436
]
3537

3638
override func viewDidLoad() {
@@ -89,6 +91,8 @@ extension ViewController: UITableViewDataSource, UITableViewDelegate {
8991
vc = LXFFullScreenableViewAutoController()
9092
case .fullScreenableMultiVc:
9193
vc = LXFFullScreenableMultiVcController()
94+
case .fullScreenableNest:
95+
vc = LXFFullScreenableNestController()
9296
}
9397

9498
if vc == nil { return }

0 commit comments

Comments
 (0)