├── LGFSwiftPT.podspec
├── LGFSwiftPT
├── LGFSwiftPT.swift
├── LGFSwiftPT.xib
├── LGFSwiftPTFlowLayout.swift
├── LGFSwiftPTLine.swift
├── LGFSwiftPTLine.xib
├── LGFSwiftPTMethod.swift
├── LGFSwiftPTStyle.swift
├── LGFSwiftPTTitle.swift
└── LGFSwiftPTTitle.xib
├── LGFSwiftPTDemo.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── xcuserdata
│ │ └── lai.xcuserdatad
│ │ └── IDEFindNavigatorScopes.plist
└── xcshareddata
│ └── xcschemes
│ └── LGFSwiftPTDemo.xcscheme
├── LGFSwiftPTDemo
├── AppDelegate.swift
├── Assets.xcassets
│ ├── AA收款.imageset
│ │ ├── AA收款.png
│ │ └── Contents.json
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── diandian.imageset
│ │ ├── Contents.json
│ │ └── diandian.png
│ ├── 中小学.imageset
│ │ ├── Contents.json
│ │ └── 中小学.png
│ ├── 交通出行.imageset
│ │ ├── Contents.json
│ │ └── 交通出行.png
│ ├── 亲子账户.imageset
│ │ ├── Contents.json
│ │ └── 亲子账户.png
│ ├── 亲情号.imageset
│ │ ├── Contents.json
│ │ └── 亲情号.png
│ ├── 体育服务.imageset
│ │ ├── Contents.json
│ │ └── 体育服务.png
│ ├── 余额宝.imageset
│ │ ├── Contents.json
│ │ └── 余额宝.png
│ ├── 信用卡还款.imageset
│ │ ├── Contents.json
│ │ └── 信用卡还款.png
│ ├── 借呗.imageset
│ │ ├── Contents.json
│ │ └── 借呗.png
│ ├── 充值中心.imageset
│ │ ├── Contents.json
│ │ └── 充值中心.png
│ ├── 出境.imageset
│ │ ├── Contents.json
│ │ └── 出境.png
│ ├── 删除.imageset
│ │ ├── Contents.json
│ │ └── 删除.png
│ ├── 医疗健康.imageset
│ │ ├── Contents.json
│ │ └── 医疗健康.png
│ ├── 发票管家.imageset
│ │ ├── Contents.json
│ │ └── 发票管家.png
│ ├── 哈啰出行.imageset
│ │ ├── Contents.json
│ │ └── 哈啰出行.png
│ ├── 商家服务.imageset
│ │ ├── Contents.json
│ │ └── 商家服务.png
│ ├── 城市服务.imageset
│ │ ├── Contents.json
│ │ └── 城市服务.png
│ ├── 天猫.imageset
│ │ ├── Contents.json
│ │ └── 天猫.png
│ ├── 奖励金.imageset
│ │ ├── Contents.json
│ │ └── 奖励金.png
│ ├── 安全备忘.imageset
│ │ ├── Contents.json
│ │ └── 安全备忘.png
│ ├── 彩票.imageset
│ │ ├── Contents.json
│ │ └── 彩票.png
│ ├── 我的快递.imageset
│ │ ├── Contents.json
│ │ └── 我的快递.png
│ ├── 更多.imageset
│ │ ├── Contents.json
│ │ └── 更多.png
│ ├── 校园生活.imageset
│ │ ├── Contents.json
│ │ └── 校园生活.png
│ ├── 汇率换算.imageset
│ │ ├── Contents.json
│ │ └── 汇率换算.png
│ ├── 淘宝.imageset
│ │ ├── Contents.json
│ │ └── 淘宝.png
│ ├── 淘票票电影.imageset
│ │ ├── Contents.json
│ │ └── 淘票票.png
│ ├── 添加.imageset
│ │ ├── Contents.json
│ │ └── 添加.png
│ ├── 滴滴出行.imageset
│ │ ├── Contents.json
│ │ └── 嘀嘀出行.png
│ ├── 火车票机票.imageset
│ │ ├── Contents.json
│ │ └── 火车票机票.png
│ ├── 生活缴费.imageset
│ │ ├── Contents.json
│ │ └── 生活缴费.png
│ ├── 红包.imageset
│ │ ├── Contents.json
│ │ └── 红包.png
│ ├── 芝麻信用.imageset
│ │ ├── Contents.json
│ │ └── 芝麻信用.png
│ ├── 花呗.imageset
│ │ ├── Contents.json
│ │ └── 花呗.png
│ ├── 虚线框.imageset
│ │ ├── Contents.json
│ │ └── 虚线框.png
│ ├── 蚂上租租房.imageset
│ │ ├── Contents.json
│ │ └── 蚂上租租房.png
│ ├── 蚂蚁保险.imageset
│ │ ├── Contents.json
│ │ └── 蚂蚁保险.png
│ ├── 蚂蚁森林.imageset
│ │ ├── Contents.json
│ │ └── 蚂蚁森林.png
│ ├── 记账本.imageset
│ │ ├── Contents.json
│ │ └── 记账本.png
│ ├── 车主服务.imageset
│ │ ├── Contents.json
│ │ └── 车主服务.png
│ ├── 转账.imageset
│ │ ├── Contents.json
│ │ └── 转账.png
│ ├── 运动.imageset
│ │ ├── Contents.json
│ │ └── 运动.png
│ ├── 飞猪酒店.imageset
│ │ ├── Contents.json
│ │ └── 飞猪酒店.png
│ ├── 饿了么外卖.imageset
│ │ ├── Contents.json
│ │ └── 饿了么外卖.png
│ └── 高德打车.imageset
│ │ ├── Contents.json
│ │ └── 高德打车.png
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Info.plist
├── Tool
│ ├── LGF+UIColor.swift
│ ├── LGF+UIDevice.swift
│ └── Toast.swift
├── ViewController.swift
└── 支付宝编辑页效果
│ ├── VerticalViewController.storyboard
│ ├── VerticalViewController.swift
│ └── View
│ ├── VerticalViewControllerCell.swift
│ ├── VerticalViewControllerOneCell.swift
│ ├── VerticalViewControllerReusableView.swift
│ └── VerticalViewControllerThreeCell.swift
├── LICENSE
└── README.md
/LGFSwiftPT.podspec:
--------------------------------------------------------------------------------
1 |
2 | Pod::Spec.new do |s|
3 | s.name = "LGFSwiftPT"
4 | s.version = "0.1.1"
5 | s.summary = "LGFSwiftPT"
6 | s.homepage = "https://github.com/aiononhiii/LGFSwiftPT.git"
7 | s.license = { :type => 'MIT', :file => 'LICENSE' }
8 | s.authors = { "aiononhiii" => "452354033@qq.com" }
9 | s.requires_arc = true
10 | s.platform = :ios, "9.0"
11 | s.source = { :git => "https://github.com/aiononhiii/LGFSwiftPT.git", :tag => s.version }
12 | s.framework = "UIKit"
13 | s.source_files = 'LGFSwiftPT/*.swift'
14 | s.resource_bundles = {
15 | 'LGFSwiftPT' => ['LGFSwiftPT/*.xib']
16 | }
17 | s.swift_version = "4.2"
18 | s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' }
19 | end
20 |
--------------------------------------------------------------------------------
/LGFSwiftPT/LGFSwiftPT.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LGFSwiftPT/LGFSwiftPTFlowLayout.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LGFSwiftPTFlowLayout.swift
3 | // LGFSwiftPT
4 | //
5 | // Created by 来 on 2019/10/10.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public protocol LGFSwiftPTFlowLayoutDelegate: NSObjectProtocol {
12 | // MARK: - 自定义分页动画(我这里提供一个配置入口,也可以自己在外面配置 UICollectionViewFlowLayout 原理一样,自己在外面配置的话记得配置 self.scrollDirection = .horizontal self.minimumInteritemSpacing = 0 self.minimumLineSpacing = 0 self.sectionInset = UIEdgeInsets.init(top: 0, left: 0, bottom: 0, right: 0))
13 | func lgf_FreePageViewCustomizeAnimation(_ attributes: [UICollectionViewLayoutAttributes], _ flowLayout: UICollectionViewFlowLayout)
14 | }
15 |
16 | public class LGFSwiftPTFlowLayout: UICollectionViewFlowLayout {
17 | public weak var lgf_SwiftPTFlowLayoutDelegate: LGFSwiftPTFlowLayoutDelegate?
18 | public var lgf_PVAnimationType: lgf_FreePageViewAnimationType!
19 |
20 | override public func prepare() {
21 | super.prepare()
22 | scrollDirection = .horizontal
23 | minimumInteritemSpacing = 0.0
24 | minimumLineSpacing = 0.0
25 | sectionInset = .zero
26 | }
27 |
28 | override public func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
29 | return true
30 | }
31 |
32 | override public func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
33 | let attrs = super.layoutAttributesForElements(in: rect)?.map { ($0.copy() as! UICollectionViewLayoutAttributes) } ?? []
34 | switch lgf_PVAnimationType {
35 | case .topToBottom?:
36 | self.lgf_FreePageViewTopToBottomAnimationConfig(attrs, self)
37 | break
38 | case .smallToBig?:
39 | self.lgf_FreePageViewSmallToBigAnimationConfig(attrs, self)
40 | break
41 | case .customize?:
42 | lgf_SwiftPTFlowLayoutDelegate?.lgf_FreePageViewCustomizeAnimation(attrs, self)
43 | debugPrint(String.init(format: "🤖️:自定义分页动画的 contentOffset.x:%f", collectionView!.contentOffset.x))
44 | break
45 | default:
46 | break
47 | }
48 | return attrs
49 | }
50 |
51 | deinit {
52 | debugPrint("🤖️:LGFSwiftPTFlowLayout --- 已释放 ✈️")
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/LGFSwiftPT/LGFSwiftPTLine.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LGFSwiftPTLine.swift
3 | // LGFSwiftPT
4 | //
5 | // Created by 来 on 2019/10/9.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public protocol LGFSwiftPTLineDelegate: NSObjectProtocol {
12 |
13 | // MARK: - 加载 line 网络图片代理,具体加载框架我的 Demo 不做约束,请自己选择图片加载框架,使用前请打开 lgf_IsNetImage
14 | /// - Parameters:
15 | /// - imageView: 要加载网络图片的 imageView
16 | /// - imageUrl: 网络图片的 Url
17 | func lgf_GetLineNetImage(_ imageView: UIImageView, _ imageUrl: URL!)
18 |
19 | // MARK: - 实现这个代理来对 LGFSwiftPTLine 生成时某些系统属性进行配置 backgroundColor/borderColor/CornerRadius等等
20 | /// - Parameters:
21 | /// - lgf_SwiftPTLine: LGFSwiftPTLine 本体
22 | /// - style: LGFSwiftPTStyle
23 | func lgf_GetLine(_ lgf_SwiftPTLine: UIImageView, _ style: LGFSwiftPTStyle)
24 | }
25 |
26 | public class LGFSwiftPTLine: UIImageView {
27 |
28 | /// LGFSwiftPTLine 主代理
29 | public weak var lgf_SwiftPTLineDelegate: LGFSwiftPTLineDelegate?
30 |
31 | /// 配置用模型
32 | public private(set) weak var lgf_Style: LGFSwiftPTStyle! {
33 | didSet {
34 | // 坐标配置
35 | let Y = lgf_Style.lgf_PVTitleView.lgfpt_Height - ((lgf_Style.lgf_LineHeight + lgf_Style.lgf_LineBottom) > lgf_Style.lgf_PVTitleView.lgfpt_Height ? lgf_Style.lgf_PVTitleView.lgfpt_Height : (lgf_Style.lgf_LineHeight + lgf_Style.lgf_LineBottom))
36 | let H = (lgf_Style.lgf_LineHeight + lgf_Style.lgf_LineBottom) > lgf_Style.lgf_PVTitleView.lgfpt_Height ? (lgf_Style.lgf_PVTitleView.lgfpt_Height - lgf_Style.lgf_LineBottom) : lgf_Style.lgf_LineHeight
37 | switch lgf_Style.lgf_LineWidthType {
38 | case .fixedWith:
39 | lgfpt_Width = lgf_Style.lgf_LineWidth
40 | break
41 | case .equalTitle:
42 | lgfpt_Width = lgf_Style.lgf_TitleFixedWidth
43 | break
44 | default:
45 | break
46 | }
47 | lgfpt_Y = Y
48 | lgfpt_Height = H
49 | // 添加 line 图片
50 | if lgf_Style.lgf_LineImageName.count > 0 && subviews.count == 0 {
51 | if lgf_Style.lgf_IsLineNetImage {
52 | lgf_SwiftPTLineDelegate?.lgf_GetLineNetImage(self, URL.init(string: lgf_Style.lgf_LineImageName))
53 | } else {
54 | image = UIImage.init(named: lgf_Style.lgf_LineImageName, in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
55 | }
56 | }
57 | // 非主要属性配置
58 | if lgf_Style.lgf_LineCornerRadius > 0.0 {
59 | layer.cornerRadius = lgf_Style.lgf_LineCornerRadius
60 | if !clipsToBounds { clipsToBounds = true }
61 | }
62 | if lgf_Style.lgf_TitleBorderWidth > 0.0 {
63 | layer.borderWidth = lgf_Style.lgf_LineBorderWidth
64 | layer.borderColor = lgf_Style.lgf_LineBorderColor.cgColor
65 | if !clipsToBounds { clipsToBounds = true }
66 | }
67 | contentMode = lgf_Style.lgf_LineImageContentMode
68 | backgroundColor = lgf_Style.lgf_LineColor
69 |
70 | }
71 | }
72 |
73 | // MARK: - LGFSwiftPTLine 初始化
74 | /// - Parameters:
75 | /// - style: LGFSwiftPTStyle
76 | /// - delegate: LGFSwiftPTLineDelegate
77 | class func lgf_AllocLine(_ style: LGFSwiftPTStyle, _ delegate: LGFSwiftPTLineDelegate) -> LGFSwiftPTLine {
78 | let line = LGFSwiftPTStyle.LGFPTBundle.loadNibNamed(String(describing: LGFSwiftPTLine.self.classForCoder()), owner: self, options: nil)?.first as! LGFSwiftPTLine
79 | line.lgf_SwiftPTLineDelegate = delegate
80 | line.lgf_Style = style
81 | // 这个代理放在最下面,对一些 LGFSwiftPTStyle 配置的属性拥有最终修改权
82 | line.lgf_SwiftPTLineDelegate?.lgf_GetLine(line, style)
83 | return line
84 | }
85 |
86 | deinit {
87 | debugPrint("🤖️:LGFSwiftPTLine --- 已释放 ✈️")
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/LGFSwiftPT/LGFSwiftPTLine.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/LGFSwiftPT/LGFSwiftPTMethod.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LGFSwiftPTMethod.swift
3 | // LGFSwiftPT
4 | //
5 | // Created by 来 on 2019/10/9.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | /*
13 | LGFSwiftPTMethod 这里的所有代码都可以用自定义来代替(可用作自定义动画时的参考)
14 | */
15 |
16 | public extension LGFSwiftPT {
17 | // MARK: ------------------- 我自己原配的 line 滚动动画逻辑代码
18 | public func lgf_AutoScrollLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ progress: CGFloat) {
19 | switch style.lgf_LineAnimation {
20 | case .defult:
21 | lgf_PageLineAnimationDefultScrollLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, progress)
22 | break
23 | case .shortToLong:
24 | lgf_PageLineAnimationShortToLongScrollLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, progress)
25 | break
26 | case .hideShow:
27 | lgf_PageLineAnimationHideShowScrollLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, progress)
28 | break
29 | case .smallToBig:
30 | lgf_PageLineAnimationSmallToBigScrollLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, progress)
31 | break
32 | case .tortoiseDown:
33 | lgf_PageLineAnimationTortoiseDownScrollLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, progress)
34 | break
35 | case .tortoiseUp:
36 | lgf_PageLineAnimationTortoiseUpScrollLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, progress)
37 | break
38 | default:
39 | break
40 | }
41 | }
42 |
43 | public func lgf_PageLineAnimationDefultScrollLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ progress: CGFloat) {
44 | line.lgfpt_X = selectX * progress + unSelectX * (1.0 - progress)
45 | line.lgfpt_Width = selectWidth * progress + unSelectWidth * (1.0 - progress)
46 | }
47 |
48 | public func lgf_PageLineAnimationShortToLongScrollLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ progress: CGFloat) {
49 | var space: CGFloat = 0.0
50 | if style.lgf_IsZoomExtruding {
51 | space = (unSelectTitle.lgfpt_Width - unSelectWidth) / 2.0 + (selectTitle.lgfpt_Width - selectWidth) / 2.0
52 | } else {
53 | space = (unSelectTitle.lgfpt_Width / unSelectTitle.lgf_CurrentTransformSX - unSelectWidth) / 2.0 + (selectTitle.lgfpt_Width / selectTitle.lgf_CurrentTransformSX - selectWidth) / 2.0
54 | }
55 | if progress > 0.5 {
56 | if unSelectIndex < selectIndex {
57 | line.lgfpt_X = selectX - (space + unSelectWidth) * 2.0 * (1.0 - progress)
58 | } else {
59 | line.lgfpt_X = selectX
60 | }
61 | } else {
62 | if unSelectIndex > selectIndex {
63 | line.lgfpt_X = unSelectX - (space + selectWidth) * 2.0 * progress
64 | } else {
65 | line.lgfpt_X = unSelectX
66 | }
67 | }
68 | if progress > 0.5 {
69 | line.lgfpt_Width = selectWidth + (unSelectWidth + space) * 2.0 * (1.0 - progress)
70 | } else {
71 | line.lgfpt_Width = unSelectWidth + (selectWidth + space) * 2.0 * progress
72 | }
73 | }
74 |
75 | public func lgf_PageLineAnimationHideShowScrollLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ progress: CGFloat) {
76 | if progress > 0.5 {
77 | line.lgfpt_X = selectX
78 | line.lgfpt_Width = selectWidth
79 | line.alpha = 1.0 - (2.0 * (1.0 - progress))
80 | } else {
81 | line.lgfpt_X = unSelectX
82 | line.lgfpt_Width = unSelectWidth
83 | line.alpha = 1.0 - (2.0 * progress)
84 | }
85 | }
86 |
87 | public func lgf_PageLineAnimationSmallToBigScrollLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ progress: CGFloat) {
88 | line.transform = CGAffineTransform.identity
89 | if progress > 0.5 {
90 | let num = 1.0 - (2.0 * (1.0 - progress))
91 | line.lgfpt_X = selectX
92 | line.lgfpt_Width = selectWidth
93 | line.transform = CGAffineTransform.init(scaleX: num, y: num)
94 | } else {
95 | let num = 1.0 - (2.0 * progress)
96 | line.lgfpt_X = unSelectX
97 | line.lgfpt_Width = unSelectWidth
98 | line.transform = CGAffineTransform.init(scaleX: num, y: num)
99 | }
100 | }
101 |
102 | public func lgf_PageLineAnimationTortoiseDownScrollLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ progress: CGFloat) {
103 | let space = style.lgf_LineBottom + line.lgfpt_Height
104 | if progress > 0.5 {
105 | line.lgfpt_X = selectX
106 | line.lgfpt_Width = selectWidth
107 | line.transform = CGAffineTransform.identity
108 | line.transform = CGAffineTransform.init(translationX: 0.0, y: space * (2.0 * (1.0 - progress)))
109 | } else {
110 | line.lgfpt_X = unSelectX
111 | line.lgfpt_Width = unSelectWidth
112 | line.transform = CGAffineTransform.identity
113 | line.transform = CGAffineTransform.init(translationX: 0.0, y: space + space * (1.0 - (2.0 * (1.0 - progress))))
114 | }
115 | }
116 |
117 | public func lgf_PageLineAnimationTortoiseUpScrollLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ progress: CGFloat) {
118 | let space = style.lgf_LineBottom - style.lgf_PVTitleView.lgfpt_Height
119 | if progress > 0.5 {
120 | line.lgfpt_X = selectX
121 | line.lgfpt_Width = selectWidth
122 | line.transform = CGAffineTransform.identity
123 | line.transform = CGAffineTransform.init(translationX: 0.0, y: space * (2.0 * (1.0 - progress)))
124 | } else {
125 | line.lgfpt_X = unSelectX
126 | line.lgfpt_Width = unSelectWidth
127 | line.transform = CGAffineTransform.identity
128 | line.transform = CGAffineTransform.init(translationX: 0.0, y: space + space * (1.0 - (2.0 * (1.0 - progress))))
129 | }
130 | }
131 |
132 | // MARK: ------------------- 我自己原配的 line 点击动画逻辑代码
133 | public func lgf_AutoClickLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ duration: TimeInterval) {
134 | switch style.lgf_LineAnimation {
135 | case .defult:
136 | lgf_PageLineAnimationDefultClickLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, duration)
137 | break
138 | case .shortToLong:
139 | lgf_PageLineAnimationShortToLongClickLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, duration)
140 | break
141 | case .hideShow:
142 | lgf_PageLineAnimationHideShowClickLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, duration)
143 | break
144 | case .smallToBig:
145 | lgf_PageLineAnimationSmallToBigClickLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, duration)
146 | break
147 | case .tortoiseDown:
148 | lgf_PageLineAnimationTortoiseDownClickLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, duration)
149 | break
150 | case .tortoiseUp:
151 | lgf_PageLineAnimationTortoiseUpClickLineAnimationConfig(style, selectX, selectWidth, unSelectX, unSelectWidth, unSelectTitle, selectTitle, unSelectIndex, selectIndex, line, duration)
152 | break
153 | default:
154 | break
155 | }
156 | }
157 |
158 | public func lgf_PageLineAnimationDefultClickLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ duration: TimeInterval) {
159 | line.lgfpt_X = selectX
160 | line.lgfpt_Width = selectWidth
161 | }
162 |
163 | public func lgf_PageLineAnimationShortToLongClickLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ duration: TimeInterval) {
164 | line.lgfpt_X = selectX
165 | line.lgfpt_Width = selectWidth
166 | }
167 |
168 | public func lgf_PageLineAnimationHideShowClickLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ duration: TimeInterval) {
169 | // 通过关键帧动画配合我给你的 duration,你应该可以实现很多你想要的独有的效果
170 | UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 0.5 - (0.0001 / duration)) {
171 | line.alpha = 0.0
172 | }
173 | UIView.addKeyframe(withRelativeStartTime: 0.5 + (0.0001 / duration), relativeDuration: 0.5 - (0.0001 / duration)) {
174 | line.alpha = 1.0
175 | }
176 | UIView.addKeyframe(withRelativeStartTime: 0.5 - (0.0001 / duration), relativeDuration: 0.0002 / duration) {
177 | line.lgfpt_X = selectX
178 | line.lgfpt_Width = selectWidth
179 | }
180 | }
181 |
182 | public func lgf_PageLineAnimationSmallToBigClickLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ duration: TimeInterval) {
183 | // 通过关键帧动画配合我给你的 duration,你应该可以实现很多你想要的独有的效果
184 | UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 0.5 - (0.0001 / duration)) {
185 | line.transform = CGAffineTransform.init(scaleX: 0.0001, y: 0.0001)
186 | }
187 | UIView.addKeyframe(withRelativeStartTime: 0.5 + (0.0001 / duration), relativeDuration: 0.5 - (0.0001 / duration)) {
188 | line.transform = CGAffineTransform.identity
189 | }
190 | UIView.addKeyframe(withRelativeStartTime: 0.5 - (0.0001 / duration), relativeDuration: 0.0002 / duration) {
191 | line.lgfpt_X = selectX
192 | line.lgfpt_Width = selectWidth
193 | }
194 | }
195 |
196 | public func lgf_PageLineAnimationTortoiseDownClickLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ duration: TimeInterval) {
197 | let space = style.lgf_LineBottom + line.lgfpt_Height
198 | // 通过关键帧动画配合我给你的 duration,你应该可以实现很多你想要的独有的效果
199 | UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 0.5 - (0.0001 / duration)) {
200 | line.transform = CGAffineTransform.init(translationX: 0.0, y: space)
201 | }
202 | UIView.addKeyframe(withRelativeStartTime: 0.5 + (0.0001 / duration), relativeDuration: 0.5 - (0.0001 / duration)) {
203 | line.transform = CGAffineTransform.identity
204 | }
205 | UIView.addKeyframe(withRelativeStartTime: 0.5 - (0.0001 / duration), relativeDuration: 0.0002 / duration) {
206 | line.lgfpt_X = selectX
207 | line.lgfpt_Width = selectWidth
208 | }
209 | }
210 |
211 | public func lgf_PageLineAnimationTortoiseUpClickLineAnimationConfig(_ style: LGFSwiftPTStyle, _ selectX: CGFloat, _ selectWidth: CGFloat, _ unSelectX: CGFloat, _ unSelectWidth: CGFloat, _ unSelectTitle: LGFSwiftPTTitle, _ selectTitle: LGFSwiftPTTitle, _ unSelectIndex: Int, _ selectIndex: Int, _ line: LGFSwiftPTLine, _ duration: TimeInterval) {
212 | let space = style.lgf_LineBottom - style.lgf_PVTitleView.lgfpt_Height
213 | // 通过关键帧动画配合我给你的 duration,你应该可以实现很多你想要的独有的效果
214 | UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 0.5 - (0.0001 / duration)) {
215 | line.transform = CGAffineTransform.init(translationX: 0.0, y: space)
216 | }
217 | UIView.addKeyframe(withRelativeStartTime: 0.5 + (0.0001 / duration), relativeDuration: 0.5 - (0.0001 / duration)) {
218 | line.transform = CGAffineTransform.identity
219 | }
220 | UIView.addKeyframe(withRelativeStartTime: 0.5 - (0.0001 / duration), relativeDuration: 0.0002 / duration) {
221 | line.lgfpt_X = selectX
222 | line.lgfpt_Width = selectWidth
223 | }
224 | }
225 |
226 | // MARK: ------------------- 我自己原配的 标 跟随动画逻辑代码
227 | public func lgf_AutoTitleScrollFollowAnimationConfig(_ style: LGFSwiftPTStyle, _ lgf_TitleButtons: [LGFSwiftPTTitle], _ unSelectIndex: Int, _ selectIndex: Int, _ duration: TimeInterval) {
228 | switch style.lgf_TitleScrollFollowType {
229 | case .defult:
230 | lgf_TitleScrollFollowDefultAnimationConfig(style, lgf_TitleButtons, unSelectIndex, selectIndex, duration)
231 | break
232 | case .leftRight:
233 | lgf_TitleScrollFollowLeftRightAnimationConfig(style, lgf_TitleButtons, unSelectIndex, selectIndex, duration)
234 | break
235 | default:
236 | break
237 | }
238 | }
239 |
240 | public func lgf_TitleScrollFollowDefultAnimationConfig(_ style: LGFSwiftPTStyle, _ lgf_TitleButtons: [LGFSwiftPTTitle], _ unSelectIndex: Int, _ selectIndex: Int, _ duration: TimeInterval) {
241 | let selectTitle = lgf_TitleButtons[selectIndex]
242 | let offSetx = min(max(selectTitle.center.x - style.lgf_PVTitleView.lgfpt_Width * 0.5, 0.0), max(style.lgf_PVTitleView.contentSize.width - style.lgf_PVTitleView.lgfpt_Width, 0.0))
243 | UIView.animate(withDuration: duration) {
244 | style.lgf_PVTitleView.contentOffset = CGPoint.init(x: offSetx, y: 0.0)
245 | }
246 | }
247 |
248 | public func lgf_TitleScrollFollowLeftRightAnimationConfig(_ style: LGFSwiftPTStyle, _ lgf_TitleButtons: [LGFSwiftPTTitle], _ unSelectIndex: Int, _ selectIndex: Int, _ duration: TimeInterval) {
249 | let isRight = selectIndex > unSelectIndex
250 | let title = lgf_TitleButtons[isRight ? min(selectIndex + 1, lgf_TitleButtons.count - 1) : max(selectIndex - 1, 0)]
251 | UIView.animate(withDuration: duration) {
252 | if isRight {
253 | if selectIndex == (lgf_TitleButtons.count - 1) {
254 | style.lgf_PVTitleView.contentOffset = CGPoint.init(x: style.lgf_PVTitleView.contentSize.width - style.lgf_PVTitleView.lgfpt_Width, y: 0.0)
255 | } else {
256 | if (title.lgfpt_X + title.lgfpt_Width) >= (style.lgf_PVTitleView.contentOffset.x + style.lgf_PVTitleView.lgfpt_Width) {
257 | style.lgf_PVTitleView.contentOffset = CGPoint.init(x: title.lgfpt_X + title.lgfpt_Width - style.lgf_PVTitleView.lgfpt_Width + (((selectIndex + 1) == (lgf_TitleButtons.count - 1)) ? style.lgf_PageLeftRightSpace : 0.0), y: 0.0)
258 | }
259 | }
260 | } else {
261 | if selectIndex == 0 {
262 | style.lgf_PVTitleView.contentOffset = CGPoint.init(x: 0.0, y: 0.0)
263 | } else {
264 | if title.lgfpt_X < style.lgf_PVTitleView.contentOffset.x {
265 | style.lgf_PVTitleView.contentOffset = CGPoint.init(x: title.lgfpt_X - (((selectIndex - 1) == 0) ? style.lgf_PageLeftRightSpace : 0.0), y: 0.0)
266 | }
267 | }
268 | }
269 | }
270 | }
271 |
272 | // MARK: ------------------- 新增的放大缩小后紧紧贴着左右(互相挤压)(类似汽车之家效果)
273 | public func lgf_ZoomExtruding(_ allTitles: [LGFSwiftPTTitle], _ style: LGFSwiftPTStyle, _ selectTitle: LGFSwiftPTTitle, _ unSelectTitle: LGFSwiftPTTitle, _ selectIndex: Int, _ unSelectIndex: Int, _ progress: CGFloat) {
274 | for (index, title) in allTitles.enumerated() {
275 | if index == 0 {
276 | title.lgfpt_X = 0.0
277 | }
278 | if index - 1 > 0 {
279 | let left = allTitles[index - 1]
280 | left.lgfpt_X = title.lgfpt_X - left.lgfpt_Width
281 | }
282 | if index + 1 < allTitles.count {
283 | let right = allTitles[index + 1]
284 | right.lgfpt_X = title.lgfpt_X + title.lgfpt_Width
285 | }
286 | }
287 | style.lgf_PVTitleView.lgf_AutoSwiftPTContentSize()
288 | }
289 |
290 | }
291 |
292 | public extension LGFSwiftPTFlowLayout {
293 | // MARK: ------------------- 我自己原配分页动画(你可以参考我的来实现独一无二的自定义,当然你可以在我的GitHub首页把这些珍贵的代码分享给大家)
294 | public func lgf_FreePageViewTopToBottomAnimationConfig(_ attributes: [UICollectionViewLayoutAttributes], _ flowLayout: UICollectionViewFlowLayout) {
295 | let contentOffsetX = flowLayout.collectionView!.contentOffset.x
296 | let collectionViewCenterX = flowLayout.collectionView!.lgfpt_Width * 0.5
297 | attributes.forEach { (attr) in
298 | let alpha = abs(1.0 - abs(attr.center.x - contentOffsetX - collectionViewCenterX) / flowLayout.collectionView!.lgfpt_Width)
299 | let scale = -abs(abs(attr.center.x - contentOffsetX - collectionViewCenterX) / flowLayout.collectionView!.lgfpt_Width) * 50.0
300 | let index = abs(flowLayout.collectionView!.contentOffset.x / flowLayout.collectionView!.lgfpt_Width)
301 | if flowLayout.collectionView!.panGestureRecognizer.translation(in: flowLayout.collectionView!).x < 0.0 {
302 | if attr.indexPath.item != Int(index) {
303 | attr.alpha = alpha
304 | }
305 | } else {
306 | if attr.indexPath.item == Int(index) {
307 | attr.alpha = alpha
308 | }
309 | }
310 | attr.transform = CGAffineTransform.init(translationX: 0.0, y: scale)
311 | }
312 | }
313 |
314 | public func lgf_FreePageViewSmallToBigAnimationConfig(_ attributes: [UICollectionViewLayoutAttributes], _ flowLayout: UICollectionViewFlowLayout) {
315 | let contentOffsetX = flowLayout.collectionView!.contentOffset.x
316 | let collectionViewCenterX = flowLayout.collectionView!.lgfpt_Width * 0.5
317 | attributes.forEach { (attr) in
318 | let scale = (1.0 - abs(attr.center.x - contentOffsetX - collectionViewCenterX) / flowLayout.collectionView!.lgfpt_Width * 0.8)
319 | attr.transform = CGAffineTransform.init(scaleX: scale, y: scale)
320 | }
321 | }
322 | }
323 |
324 | // MARK: ------------------- 部分项目内扩展
325 | public extension String {
326 | func lgfpt_Width(_ font: UIFont, _ height: CGFloat) -> CGFloat {
327 | return self.lgfpt_TextSizeWithFont(font: font, constrainedToSize:CGSize.init(width: CGFloat.greatestFiniteMagnitude, height: height)).width + 1.0
328 | }
329 | func lgfpt_Height(_ font: UIFont, _ width: CGFloat) -> CGFloat {
330 | return self.lgfpt_TextSizeWithFont(font: font, constrainedToSize:CGSize.init(width: width, height: CGFloat.greatestFiniteMagnitude)).height + 1.0
331 | }
332 | func lgfpt_TextSizeWithFont(font: UIFont, constrainedToSize size:CGSize) -> CGSize {
333 | var textSize:CGSize!
334 | if size.equalTo(CGSize.zero) {
335 | let attributes = NSDictionary(object: font, forKey: NSAttributedString.Key.font as NSCopying)
336 | textSize = self.size(withAttributes: attributes as? [NSAttributedString.Key : Any])
337 | } else {
338 | let option = NSStringDrawingOptions.usesLineFragmentOrigin
339 | let attributes = NSDictionary(object: font, forKey: NSAttributedString.Key.font as NSCopying)
340 | let stringRect = self.boundingRect(with: size, options: option, attributes: attributes as? [NSAttributedString.Key : Any], context: nil)
341 | textSize = stringRect.size
342 | }
343 | return textSize
344 | }
345 | }
346 |
347 | public extension UIColor {
348 | struct LGFPTComponents {
349 | var _base: UIColor
350 | public var rgba: (CGFloat, CGFloat, CGFloat, CGFloat) {
351 | var r: CGFloat = 0; var g: CGFloat = 0; var b: CGFloat = 0; var a: CGFloat = 0
352 | _base.getRed(&r, green: &g, blue: &b, alpha: &a)
353 | return (r, g, b, a)
354 | }
355 | public var hsv: (CGFloat, CGFloat, CGFloat) {
356 | var h: CGFloat = 0; var s: CGFloat = 0; var v: CGFloat = 0; var a: CGFloat = 0
357 | _base.getHue(&h, saturation: &s, brightness: &v, alpha: &a)
358 | return (h, s, v)
359 | }
360 | }
361 | var lgfpt_Components: UIColor.LGFPTComponents {
362 | return LGFPTComponents(_base: self)
363 | }
364 | class func lgfpt_RandomColor() -> UIColor {
365 | return UIColor.init(red: CGFloat(arc4random() % 256) / 255.0, green: CGFloat(arc4random() % 256) / 255.0, blue: CGFloat(arc4random() % 256) / 255.0, alpha: 0.5)
366 | }
367 | }
368 |
369 | public extension UIScrollView {
370 | // MARK: - 获取横向滚动index
371 | func lgfpt_HorizontalIndex() -> Int {
372 | return Int(self.contentOffset.x / self.bounds.size.width)
373 | }
374 | }
375 |
376 | private var lgfpt_SwiftPTSpecialTitlePropertyKey: String = "lgfpt_SwiftPTSpecialTitlePropertyKey"
377 |
378 | public extension UIView {
379 |
380 | // MARK: - 用于特殊 title 赋值属性用
381 | var lgfpt_SwiftPTSpecialTitleProperty: String? {
382 | get {
383 | return (objc_getAssociatedObject(self, &lgfpt_SwiftPTSpecialTitlePropertyKey) as? String)
384 | }
385 | set {
386 | objc_setAssociatedObject(self, &lgfpt_SwiftPTSpecialTitlePropertyKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY)
387 | }
388 | }
389 |
390 | // MARK: - .x
391 | var lgfpt_X: CGFloat {
392 | get {
393 | return self.frame.origin.x
394 | }
395 | set {
396 | var rect = self.frame
397 | rect.origin.x = newValue
398 | self.frame = rect
399 | }
400 | }
401 |
402 | // MARK: - .y
403 | var lgfpt_Y: CGFloat {
404 | get {
405 | return self.frame.origin.y
406 | }
407 | set {
408 | var rect = self.frame
409 | rect.origin.y = newValue
410 | self.frame = rect
411 | }
412 | }
413 |
414 | // MARK: - .maxX
415 | var lgfpt_MaxX: CGFloat {
416 | get {
417 | return self.frame.maxX
418 | }
419 | }
420 |
421 | // MARK: - .maxY
422 | var lgfpt_MaxY: CGFloat {
423 | get {
424 | return self.frame.maxY
425 | }
426 | }
427 |
428 | // MARK: - .centerX
429 | var lgfpt_CenterX: CGFloat {
430 | get {
431 | return self.center.x
432 | }
433 | set {
434 | self.center = CGPoint(x: newValue, y: self.center.y)
435 | }
436 | }
437 |
438 | // MARK: - .centerY
439 | var lgfpt_CenterY: CGFloat {
440 | get {
441 | return self.center.y
442 | }
443 | set {
444 | self.center = CGPoint(x: self.center.x, y: newValue)
445 | }
446 | }
447 |
448 | // MARK: - .width
449 | var lgfpt_Width: CGFloat {
450 | get {
451 | return self.frame.size.width
452 | }
453 | set {
454 | var rect = self.frame
455 | rect.size.width = newValue
456 | self.frame = rect
457 | }
458 | }
459 |
460 | // MARK: - .height
461 | var lgfpt_Height: CGFloat {
462 | get {
463 | return self.frame.size.height
464 | }
465 | set {
466 | var rect = self.frame
467 | rect.size.height = newValue
468 | self.frame = rect
469 | }
470 | }
471 |
472 | // MARK: - .size
473 | var lgfpt_Size: CGSize {
474 | get {
475 | return self.frame.size
476 | }
477 | set {
478 | var rect = self.frame
479 | rect.size = newValue
480 | self.frame = rect
481 | }
482 | }
483 | }
484 |
--------------------------------------------------------------------------------
/LGFSwiftPT/LGFSwiftPTStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LGFSwiftPTStyle.swift
3 | // LGFSwiftPT
4 | //
5 | // Created by 来 on 2019/10/9.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public enum lgf_FreePageViewAnimationType {
12 | case defult/// 默认分页动画
13 | case topToBottom/// 从上往下进入的分页动画
14 | case smallToBig/// 从小到大进入的分页动画
15 | case none/// 没有分页动画
16 | case customize/// 自定义分页动画 我将返回你 layoutAttributesForElementsInRect 的所有参数,你也可以自己给外部的你自己创建的子控制器容器 collectionview 自己配置 UICollectionViewFlowLayout
17 | }
18 |
19 | public enum lgf_FreePageLineAnimationType {
20 | case defult/// title 底部线平滑改变大小
21 | case shortToLong/// title 底部线先右边伸出变宽致 title 和下一个 title 的总宽度, 再左边收回恢复到下一个 title 的宽度
22 | case hideShow/// 渐隐效果, title 底部线隐藏,再在下一个 title 的底部出现
23 | case tortoiseDown/// 乌龟的头效果, title 底部线向下隐藏,再在下一个 title 的底部向上出现
24 | case tortoiseUp/// 乌龟的头效果, title 底部线向上隐藏,再在下一个 title 的底部向下出现
25 | case smallToBig/// title 底部线缩小放大
26 | case customize/// 我想自定义这个效果,将返回你或许需要的值(selectX,selectWidth,unSelectX,unSelectWidth等等),用这些值来制造你自己想要的 line 动画
27 | }
28 |
29 | public enum lgf_FreeTitleScrollFollowType {
30 | case defult/// 在可滚动的情况下, 选中 title 默认滚动到 lgf_PVTitleView 中间
31 | case leftRight/// 向左滚动选中 title 永远出现在最右边可见位置, 反之向右滚动选中 title 永远出现在最左边可见位置(此效果不会像上面的效果那样滚到中间)(模仿腾讯新闻)(此效果可适度减少性能占用,适合复杂页面)
32 | case customize/// 我想自定义这个效果,将返回你或许需要的值
33 | }
34 |
35 | public enum lgf_FreeTitleLineWidthType {
36 | case equalTitleSTR/// 宽度等于字体宽度
37 | case equalTitleSTRAndImage/// 宽度等于字体宽度 + 图 title 宽度
38 | case equalTitle/// 宽度等于 title view宽度
39 | case fixedWith/// 宽度等于固定宽度
40 | }
41 |
42 | public class LGFSwiftPTStyle: NSObject {
43 |
44 | public static let LGFPTBundle = Bundle.init(path: Bundle.init(for: LGFSwiftPT.self).path(forResource: "LGFSwiftPT", ofType: "bundle") ?? "") ?? Bundle.main
45 |
46 | /// 开启 UI 调试模式(自定义 line 动画时可打开)
47 | public var lgf_StartDebug: Bool = false
48 | /// 展示自定义动画辅助 Print
49 | public var lgf_ShowPrint: Bool = true
50 |
51 | /// MARK: ------------------- 数据源设置 -------------------
52 | /// title 数组
53 | public lazy var lgf_Titles: [String] = []
54 |
55 | /// MARK: ------------------- 主 lgf_PVTitleView -------------------
56 | /// lgf_PVTitleView
57 | public weak var lgf_PVTitleView: LGFSwiftPT!
58 | /// lgf_PVTitleView 父视图背景色
59 | public var lgf_PVTitleViewBackgroundColor: UIColor = UIColor.clear
60 | /// 主 lgf_PVTitleView 在父控件上的frame 默认等于父控件
61 | public var lgf_PVTitleViewFrame: CGRect = .zero
62 |
63 | /// MARK: ------------------- 分页控件是否带分页动画 -------------------
64 | /// 分页控件分页动画枚举
65 | public var lgf_PVAnimationType: lgf_FreePageViewAnimationType = .defult
66 |
67 | /// MARK: ------------------- 整体序列设置 -------------------
68 | /// 当所有 title 总宽度加起来小于 lgf_PVTitleView 宽度时 是否居中显示 默认 NO - 不居中(从左边开始显示)
69 | public var lgf_IsTitleCenter: Bool = false
70 | /// 选中结束后标的回位模式 默认 defult
71 | public var lgf_TitleScrollFollowType: lgf_FreeTitleScrollFollowType = .defult
72 | /// 是否立即回位(淘宝首页立即回位)
73 | public var lgf_IsExecutedImmediatelyTitleScrollFollow: Bool = false
74 | /// page左右间距 默认 0.0
75 | public var lgf_PageLeftRightSpace: CGFloat = 0.0
76 |
77 | /// MARK: ------------------- title 设置 -------------------
78 | /// 是否支持副 title 副标题 lgf_Titles 格式:@[@"11~~~22", @"33~~~44"] 22 和 44 为副标题
79 | public var lgf_IsDoubleTitle: Bool = false
80 | /// title 固定宽度 默认等于 0.0 如果此属性大于 0.0 那么 title 宽度将为固定值
81 | /// 如果设置此项(lgf_TitleFixedWidth) LGFTitleLineWidthType 将只支持 FixedWith 固定底部线宽度
82 | public var lgf_TitleFixedWidth: CGFloat = 0.0
83 | /// 选中 title 放大缩小倍数 默认 1.0(不放大缩小)
84 | public var lgf_TitleTransformSX: CGFloat = 1.0 {
85 | didSet {
86 | lgf_TitleTransformSX = lgf_TitleTransformSX == 0.0 ? 0.00001 : lgf_TitleTransformSX
87 | }
88 | }
89 | /// title 中间是否有分割线
90 | public var lgf_IsHaveCenterLine: Bool = false
91 | /// title 分割线 颜色
92 | public var lgf_CenterLineColor: UIColor = UIColor.black
93 | /// title 分割线 size
94 | public var lgf_CenterLineSize: CGSize = CGSize.init(width: 1.0, height: 6.0)
95 | /// title 分割线 X/Y 轴偏移
96 | public var lgf_CenterLineCenter: CGPoint = CGPoint.init(x: 0.0, y: 0.0)
97 | /// 选中 title 字体颜色 默认 blackColor 黑色 (对应 lgf_TitleUnSelectColor 两个颜色一样则取消渐变效果)
98 | public var lgf_TitleSelectColor: UIColor = UIColor.black
99 | /// 未选中 title 字体颜色 默认 lightGrayColor 淡灰色 (对应 lgf_TitleSelectColor 两个颜色一样则取消渐变效果)
100 | public var lgf_UnTitleSelectColor: UIColor = UIColor.lightGray
101 | /// title 选中字体 默认 [UIFont systemFontOfSize:14]
102 | public var lgf_TitleSelectFont: UIFont = UIFont.systemFont(ofSize: 14)
103 | /// title 未选中字体 默认 和选中字体一样
104 | public var lgf_UnTitleSelectFont: UIFont = UIFont.systemFont(ofSize: 14)
105 | /// 选中 title 放大缩小后紧紧贴着左右(互相挤压)(需配合下面的 lgf_MainTitleTransformSX 使用)(类似汽车之家效果)
106 | public var lgf_IsZoomExtruding: Bool = true
107 | /// 选中主 title 放大缩小倍数 默认 1.0(不放大缩小)
108 | public var lgf_MainTitleTransformSX: CGFloat = 1.0 {
109 | didSet {
110 | lgf_MainTitleTransformSX = lgf_MainTitleTransformSX == 0.0 ? 0.00001 : lgf_MainTitleTransformSX
111 | }
112 | }
113 | /// 选中主 title 上下偏移数 默认 0.0(不上下偏移)
114 | public var lgf_MainTitleTransformTY: CGFloat = 0.0
115 | /// 选中主 title 左右偏移数 默认 0.0(不左右偏移)
116 | public var lgf_MainTitleTransformTX: CGFloat = 0.0
117 | /// 副 title 默认和 title 一样
118 | public var lgf_SubTitleSelectColor: UIColor = UIColor.black
119 | public var lgf_UnSubTitleSelectColor: UIColor = UIColor.lightGray
120 | public var lgf_SubTitleSelectFont: UIFont = UIFont.systemFont(ofSize: 14)
121 | public var lgf_UnSubTitleSelectFont: UIFont = UIFont.systemFont(ofSize: 14)
122 | /// 副 title 和 主 title 的距离
123 | public var lgf_SubTitleTopSpace: CGFloat = 0.0
124 | /// 选中副 title 放大缩小倍数 默认 1.0(不放大缩小)
125 | public var lgf_SubTitleTransformSX: CGFloat = 1.0 {
126 | didSet {
127 | lgf_SubTitleTransformSX = lgf_SubTitleTransformSX == 0.0 ? 0.00001 : lgf_SubTitleTransformSX
128 | }
129 | }
130 | /// 选中副 title 上下偏移数 默认 0.0(不上下偏移)
131 | public var lgf_SubTitleTransformTY: CGFloat = 0.0
132 | /// 选中副 title 左右偏移数 默认 0.0(不左右偏移)
133 | public var lgf_SubTitleTransformTX: CGFloat = 0.0
134 | /// line 是否对准 副 title
135 | public var lgf_IsLineAlignSubTitle: Bool = false {
136 | didSet {
137 | if !lgf_IsDoubleTitle {
138 | lgf_IsLineAlignSubTitle = false
139 | }
140 | }
141 | }
142 | /// title 是否有滑动动画 默认 YES 有动画
143 | public var lgf_TitleHaveAnimation: Bool = true
144 | /// title 左右间距 默认 0.0
145 | public var lgf_TitleLeftRightSpace: CGFloat = 0.0
146 | /// 点击 title 移动动画时间 默认 0.3
147 | public var lgf_TitleClickAnimationDuration: TimeInterval = 0.3
148 | /// 点击 title 后移动 title 居中动画时间 默认 0.2
149 | public var lgf_TitleScrollToTheMiddleAnimationDuration: TimeInterval = 0.25
150 | /// title 部分 **(非主要属性)**
151 | public var lgf_TitleCornerRadius: CGFloat = 0.0
152 | public var lgf_TitleBorderWidth: CGFloat = 0.0
153 | public var lgf_TitleBorderColor: UIColor = UIColor.clear
154 |
155 | /// MARK: ------------------- ******** 特殊 title 设置 ******* -------------------
156 | /// 要替换的特殊 title 数组(数组中元素 view (改 view 最好为单列,以方便设置 选中状态/动效/动画 等特殊处理) 的 lgf_SwiftPTSpecialTitleArray(值格式:@"0~~~80") 字符串属性转化为数组后 数组的 firstObject(0) 即为要替换 title 的 index, 数组的 lastObject(80) 即为要替换 title 的自定义宽度)(记住这只是障眼法替换,因此原数据源支撑 UI 展示的数据必须存在,可设置为空字符串)
157 | public lazy var lgf_SwiftPTSpecialTitleArray: [UIView] = []
158 |
159 | /// MARK: ------------------- title 图片设置 -------------------
160 | /// 图片Bundle 如果图片不在本控件bundel里请设置
161 | public var lgf_ImageBundel: Bundle = Bundle.main
162 | /// title 图片 ContentMode **(非主要属性)**
163 | public var lgf_TitleImageContentMode: UIView.ContentMode = .scaleToFill
164 | /// lgf_SelectImageNames 和 lgf_SameSelectImageName 设置一个就行 如果都设置了默认取 lgf_SameSelectImageName
165 | /// 设置不同图 title 数组(必须和titles数组count保持一致,如果某一个 title 不想设置图 title 名字传空即可)
166 | /// 选中图 title 数组和未选中图 title 数组如果只传了其中一个,将没有选中效果
167 | public var lgf_SelectImageNames: [String] = [] {
168 | didSet {
169 | if lgf_UnSelectImageNames.count == 0 {
170 | lgf_UnSelectImageNames = lgf_SelectImageNames
171 | }
172 | }
173 | }
174 | public var lgf_UnSelectImageNames: [String] = [] {
175 | didSet {
176 | if lgf_SelectImageNames.count == 0 {
177 | lgf_SelectImageNames = lgf_UnSelectImageNames
178 | }
179 | }
180 | }
181 | /// 设置所有图 title 为相同
182 | public var lgf_SameSelectImageName: String = "" {
183 | didSet {
184 | if lgf_SameUnSelectImageName.count == 0 {
185 | lgf_SameUnSelectImageName = lgf_SameSelectImageName
186 | }
187 | }
188 | }
189 | public var lgf_SameUnSelectImageName: String = "" {
190 | didSet {
191 | if lgf_SameSelectImageName.count == 0 {
192 | lgf_SameSelectImageName = lgf_SameUnSelectImageName
193 | }
194 | }
195 | }
196 | /// 是否是网络图片
197 | public var lgf_IsNetImage: Bool = false
198 |
199 | /// 以下属性只要有值,对应imageview就会显示出来
200 | /// 顶部 title 图片与 title 的间距 默认 0
201 | public var lgf_TopImageSpace: CGFloat = 0.0
202 | /// 顶部 title 图片宽度 默认等于设置的高度 最大不超过 title view高度
203 | public var lgf_TopImageWidth: CGFloat = 0.0 {
204 | didSet {
205 | if lgf_TopImageWidth == 0.0 {
206 | lgf_TopImageWidth = lgf_TopImageHeight
207 | } else {
208 | if lgf_TopImageHeight == 0.0 {
209 | lgf_TopImageHeight = lgf_TopImageWidth
210 | }
211 | }
212 | }
213 | }
214 | /// 顶部 title 图片高度 默认等于设置的宽度
215 | public var lgf_TopImageHeight: CGFloat = 0.0 {
216 | didSet {
217 | if lgf_TopImageHeight == 0.0 {
218 | lgf_TopImageHeight = lgf_TopImageWidth
219 | } else {
220 | if lgf_TopImageWidth == 0.0 {
221 | lgf_TopImageWidth = lgf_TopImageHeight
222 | }
223 | }
224 | }
225 | }
226 | /// 底部 title 图片与 title 的间距 默认 0
227 | public var lgf_BottomImageSpace: CGFloat = 0.0
228 | /// 底部 title 图片宽度 默认等于设置的高度 最大不超过 title view高度
229 | public var lgf_BottomImageWidth: CGFloat = 0.0 {
230 | didSet {
231 | if lgf_BottomImageWidth == 0.0 {
232 | lgf_BottomImageWidth = lgf_BottomImageHeight
233 | } else {
234 | if lgf_BottomImageHeight == 0.0 {
235 | lgf_BottomImageHeight = lgf_BottomImageWidth
236 | }
237 | }
238 | }
239 | }
240 | /// 底部 title 图片高度 默认等于设置的宽度
241 | public var lgf_BottomImageHeight: CGFloat = 0.0 {
242 | didSet {
243 | if lgf_BottomImageHeight == 0.0 {
244 | lgf_BottomImageHeight = lgf_BottomImageWidth
245 | } else {
246 | if lgf_BottomImageWidth == 0.0 {
247 | lgf_BottomImageWidth = lgf_BottomImageHeight
248 | }
249 | }
250 | }
251 | }
252 | /// 左边 title 图片与 title 的间距 默认 0
253 | public var lgf_LeftImageSpace: CGFloat = 0.0
254 | /// 左边 title 图片宽度 默认等于设置的高度 最大不超过 title view高度
255 | public var lgf_LeftImageWidth: CGFloat = 0.0 {
256 | didSet {
257 | if lgf_LeftImageWidth == 0.0 {
258 | lgf_LeftImageWidth = lgf_LeftImageHeight
259 | } else {
260 | if lgf_LeftImageHeight == 0.0 {
261 | lgf_LeftImageHeight = lgf_LeftImageWidth
262 | }
263 | }
264 | }
265 | }
266 | /// 左边 title 图片高度 默认等于设置的宽度
267 | public var lgf_LeftImageHeight: CGFloat = 0.0 {
268 | didSet {
269 | if lgf_LeftImageHeight == 0.0 {
270 | lgf_LeftImageHeight = lgf_LeftImageWidth
271 | } else {
272 | if lgf_LeftImageWidth == 0.0 {
273 | lgf_LeftImageWidth = lgf_LeftImageHeight
274 | }
275 | }
276 | }
277 | }
278 | /// 右边 title 图片与 title 的间距 默认 0
279 | public var lgf_RightImageSpace: CGFloat = 0.0
280 | /// 右边 title 图片宽度 默认等于设置的高度 最大不超过 title view高度
281 | public var lgf_RightImageWidth: CGFloat = 0.0 {
282 | didSet {
283 | if lgf_RightImageWidth == 0.0 {
284 | lgf_RightImageWidth = lgf_RightImageHeight
285 | } else {
286 | if lgf_RightImageHeight == 0.0 {
287 | lgf_RightImageHeight = lgf_RightImageWidth
288 | }
289 | }
290 | }
291 | }
292 | /// 右边 title 图片高度 默认等于设置的宽度
293 | public var lgf_RightImageHeight: CGFloat = 0.0 {
294 | didSet {
295 | if lgf_RightImageHeight == 0.0 {
296 | lgf_RightImageHeight = lgf_RightImageWidth
297 | } else {
298 | if lgf_RightImageWidth == 0.0 {
299 | lgf_RightImageWidth = lgf_RightImageHeight
300 | }
301 | }
302 | }
303 | }
304 |
305 | /// MARK: ------------------- title 底部线设置 -------------------
306 | /// 是否显示 title 底部滚动线 默认 YES 显示
307 | public var lgf_IsShowLine: Bool = true
308 | /// title 底部滚动线 背景图片 默认 无图
309 | public var lgf_LineImageName: String = ""
310 | /// 是否是 line 网络图片
311 | public var lgf_IsLineNetImage: Bool = false
312 | /// title 底部滚动线 颜色 默认 blueColor
313 | public var lgf_LineColor: UIColor = UIColor.blue
314 | /// title 底部滚动线 动画宽度设置 默认宽度等于 title 字体宽度 - equalTitle
315 | public var lgf_LineWidthType: lgf_FreeTitleLineWidthType = .equalTitle
316 | /// title 底部滚动线 宽度 默认 0 - 设置 LGFTitleLineType 固定宽度(FixedWith)时有效
317 | public var lgf_LineWidth: CGFloat = 0.0
318 | /// title 底部滚动线 高度 默认 1.0 (line_height最大高度为 LGFSwiftPT 的高度)
319 | public var lgf_LineHeight: CGFloat = 1.0
320 | /// title 底部滚动线相对于底部位置 默认 0 - 贴于底部
321 | public var lgf_LineBottom: CGFloat = 0.0
322 | /// title 底部滚动线中心点左右偏移 默认 0 - 不偏移
323 | public var lgf_LineCenterX: CGFloat = 0.0
324 | /// title 底部滚动线滑动动画 默认 defult 有跟随动画
325 | public var lgf_LineAnimation: lgf_FreePageLineAnimationType = .defult
326 | /// title 底部滚动线 部分 **(非主要属性)**
327 | public var lgf_LineCornerRadius: CGFloat = 0.0
328 | public var lgf_LineBorderWidth: CGFloat = 0.0
329 | public var lgf_LineBorderColor: UIColor = UIColor.clear
330 | public var lgf_LineImageContentMode: UIView.ContentMode = .scaleToFill
331 |
332 | deinit {
333 | debugPrint("🤖️:LGFSwiftPTStyle --- 已释放 ✈️")
334 | }
335 | }
336 |
--------------------------------------------------------------------------------
/LGFSwiftPT/LGFSwiftPTTitle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LGFSwiftPTTitle.swift
3 | // LGFSwiftPT
4 | //
5 | // Created by 来 on 2019/10/9.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public protocol LGFSwiftPTTitleDelegate: NSObjectProtocol {
12 |
13 | // MARK: - 加载 title 网络图片代理,具体加载框架我的 Demo 不做约束,请自己选择图片加载框架,使用前请打开 lgf_IsNetImage
14 | /// - Parameters:
15 | /// - imageView: 要加载网络图片的 imageView
16 | /// - imageUrl: 网络图片的 Url
17 | func lgf_GetTitleNetImage(_ imageView: UIImageView, _ imageUrl: URL!)
18 |
19 | // MARK: - 实现这个代理来对 LGFSwiftPTTitle 初始化时某些系统属性进行配置 backgroundColor/borderColor/CornerRadius等等 注意:这些新配置如果和 LGFSwiftPTStyle 冲突将覆盖 LGFSwiftPTStyle 的效果
20 | /// - Parameters:
21 | /// - lgf_SwiftPTTitle: LGFSwiftPTTitle 本体
22 | /// - index: 所在的 index
23 | /// - style: LGFSwiftPTStyle
24 | func lgf_GetTitle(_ lgf_SwiftPTTitle: UIView, _ index: Int, _ style: LGFSwiftPTStyle)
25 |
26 | // MARK: - 实现这个代理来对 LGFSwiftPTTitle 中的 centerLine 生成时某些系统属性进行配置 backgroundColor/borderColor/CornerRadius/isHidden等等 LGFSwiftPTStyle 中 lgf_IsHaveCenterLine 需要为true
27 | /// - Parameters:
28 | /// - centerLine: centerLine 本体
29 | /// - index: 所在的 index
30 | /// - style: LGFSwiftPTStyle
31 | /// - X: (X - width / 2) 等同于 centerX
32 | /// - Y: 等同于 centerY
33 | /// - W: 等同于 width
34 | /// - H: 等同于 height
35 | func lgf_GetCenterLine(_ centerLine: UIView, _ index: Int, _ style: LGFSwiftPTStyle, _ X: NSLayoutConstraint, _ Y: NSLayoutConstraint, _ W: NSLayoutConstraint, _ H: NSLayoutConstraint)
36 | }
37 |
38 | public class LGFSwiftPTTitle: UIView {
39 |
40 | /// LGFSwiftPTTitle 主代理
41 | public weak var lgf_SwiftPTTitleDelegate: LGFSwiftPTTitleDelegate?
42 |
43 | /// 标
44 | @IBOutlet weak var lgf_Title: UILabel!
45 | /// 标宽度
46 | @IBOutlet weak var lgf_TitleWidth: NSLayoutConstraint!
47 | /// 标高度
48 | @IBOutlet weak var lgf_TitleHeight: NSLayoutConstraint!
49 | /// 标中心X
50 | @IBOutlet weak var lgf_TitleCenterX: NSLayoutConstraint!
51 | /// 标中心Y
52 | @IBOutlet weak var lgf_TitleCenterY: NSLayoutConstraint!
53 |
54 | /// 子标
55 | @IBOutlet weak var lgf_SubTitle: UILabel!
56 | /// 子标相对于标距离
57 | @IBOutlet weak var lgf_SubTitleTop: NSLayoutConstraint!
58 | /// 标宽度
59 | @IBOutlet weak var lgf_SubTitleWidth: NSLayoutConstraint!
60 | /// 子标高度(子标宽度暂时于标共享取两者MAX值)
61 | @IBOutlet weak var lgf_SubTitleHeight: NSLayoutConstraint!
62 |
63 | /// 分割线
64 | @IBOutlet weak var lgf_CenterLine: UIView!
65 | @IBOutlet weak var lgf_CenterLineX: NSLayoutConstraint!
66 | @IBOutlet weak var lgf_CenterLineY: NSLayoutConstraint!
67 | @IBOutlet weak var lgf_CenterLineWidth: NSLayoutConstraint!
68 | @IBOutlet weak var lgf_CenterLineHeight: NSLayoutConstraint!
69 |
70 | /// 标上图片相对于标距离
71 | @IBOutlet weak var lgf_TopImageSpace: NSLayoutConstraint!
72 | /// 标下图片相对于标距离
73 | @IBOutlet weak var lgf_BottomImageSpace: NSLayoutConstraint!
74 | /// 标左图片相对于标距离
75 | @IBOutlet weak var lgf_LeftImageSpace: NSLayoutConstraint!
76 | /// 标右图片相对于标距离
77 | @IBOutlet weak var lgf_RightImageSpace: NSLayoutConstraint!
78 |
79 | /// 标上图片
80 | @IBOutlet weak var lgf_TopImage: UIImageView!
81 | /// 标上图片宽度
82 | @IBOutlet weak var lgf_TopImageWidth: NSLayoutConstraint!
83 | /// 标上图片高度
84 | @IBOutlet weak var lgf_TopImageHeight: NSLayoutConstraint!
85 |
86 | /// 标下图片
87 | @IBOutlet weak var lgf_BottomImage: UIImageView!
88 | /// 标下图片宽度
89 | @IBOutlet weak var lgf_BottomImageWidth: NSLayoutConstraint!
90 | /// 标下图片高度
91 | @IBOutlet weak var lgf_BottomImageHeight: NSLayoutConstraint!
92 |
93 | /// 标左图片
94 | @IBOutlet weak var lgf_LeftImage: UIImageView!
95 | /// 标左图片宽度
96 | @IBOutlet weak var lgf_LeftImageWidth: NSLayoutConstraint!
97 | /// 标左图片高度
98 | @IBOutlet weak var lgf_LeftImageHeight: NSLayoutConstraint!
99 |
100 | /// 标右图片
101 | @IBOutlet weak var lgf_RightImage: UIImageView!
102 | /// 标右图片宽度
103 | @IBOutlet weak var lgf_RightImageWidth: NSLayoutConstraint!
104 | /// 标右图片高度
105 | @IBOutlet weak var lgf_RightImageHeight: NSLayoutConstraint!
106 |
107 | /// 选中图片数组
108 | public private(set) lazy var lgf_SelectImageNames: [String] = []
109 | /// 未选中图片数组
110 | public private(set) lazy var lgf_UnSelectImageNames: [String] = []
111 |
112 | /// 是否有标图片
113 | public private(set) var lgf_IsHaveImage: Bool = false
114 | /// 放大缩小倍数
115 | public private(set) var lgf_CurrentTransformSX: CGFloat = 1.0
116 | /// 主标题放大缩小倍数
117 | public private(set) var lgf_MainTitleCurrentTransformSX: CGFloat = 1.0
118 | /// 主标题上下位移
119 | public private(set) var lgf_MainTitleCurrentTransformTY: CGFloat = 0.0
120 | /// 主标题左右位移
121 | public private(set) var lgf_MainTitleCurrentTransformTX: CGFloat = 0.0
122 | /// 子标题放大缩小倍数
123 | public private(set) var lgf_SubTitleCurrentTransformSX: CGFloat = 1.0
124 | /// 子标题上下位移
125 | public private(set) var lgf_SubTitleCurrentTransformTY: CGFloat = 0.0
126 | /// 子标题左右位移
127 | public private(set) var lgf_SubTitleCurrentTransformTX: CGFloat = 0.0
128 | /// 标字体渐变色用数组
129 | public private(set) lazy var lgf_SelectColorRGBA: [CGFloat] = {
130 | let (r, g, b, a) = lgf_Style.lgf_TitleSelectColor.lgfpt_Components.rgba
131 | let arr = [r, g, b, a]
132 | return arr
133 | }()
134 | public private(set) lazy var lgf_UnSelectColorRGBA: [CGFloat] = {
135 | let (r, g, b, a) = lgf_Style.lgf_UnTitleSelectColor.lgfpt_Components.rgba
136 | let arr = [r, g, b, a]
137 | return arr
138 | }()
139 | public private(set) lazy var lgf_DeltaRGBA: [CGFloat] = {
140 | let r = lgf_UnSelectColorRGBA[0] - lgf_SelectColorRGBA[0]
141 | let g = lgf_UnSelectColorRGBA[1] - lgf_SelectColorRGBA[1]
142 | let b = lgf_UnSelectColorRGBA[2] - lgf_SelectColorRGBA[2]
143 | let a = lgf_UnSelectColorRGBA[3] - lgf_SelectColorRGBA[3]
144 | let arr = [r, g, b, a]
145 | return arr
146 | }()
147 | public private(set) lazy var lgf_SubSelectColorRGBA: [CGFloat] = {
148 | let (r, g, b, a) = lgf_Style.lgf_SubTitleSelectColor.lgfpt_Components.rgba
149 | let arr = [r, g, b, a]
150 | return arr
151 | }()
152 | public private(set) lazy var lgf_SubUnSelectColorRGBA: [CGFloat] = {
153 | let (r, g, b, a) = lgf_Style.lgf_UnSubTitleSelectColor.lgfpt_Components.rgba
154 | let arr = [r, g, b, a]
155 | return arr
156 | }()
157 | public private(set) lazy var lgf_SubDeltaRGBA: [CGFloat] = {
158 | let r = lgf_SubUnSelectColorRGBA[0] - lgf_SubSelectColorRGBA[0]
159 | let g = lgf_SubUnSelectColorRGBA[1] - lgf_SubSelectColorRGBA[1]
160 | let b = lgf_SubUnSelectColorRGBA[2] - lgf_SubSelectColorRGBA[2]
161 | let a = lgf_SubUnSelectColorRGBA[3] - lgf_SubSelectColorRGBA[3]
162 | let arr = [r, g, b, a]
163 | return arr
164 | }()
165 |
166 | public private(set) weak var lgf_Style: LGFSwiftPTStyle! {// 配置用模型
167 | didSet {
168 | // 非主要属性配置
169 | if lgf_Style.lgf_TitleCornerRadius > 0.0 {
170 | layer.cornerRadius = lgf_Style.lgf_TitleCornerRadius
171 | if !clipsToBounds { clipsToBounds = true }
172 | }
173 | if lgf_Style.lgf_TitleBorderWidth > 0.0 {
174 | layer.borderWidth = lgf_Style.lgf_TitleBorderWidth
175 | layer.borderColor = lgf_Style.lgf_TitleBorderColor.cgColor
176 | if !clipsToBounds { clipsToBounds = true }
177 | }
178 |
179 | // 标 Label 配置
180 | lgf_Title.textColor = lgf_Style.lgf_UnTitleSelectColor
181 | lgf_Title.font = lgf_Style.lgf_UnTitleSelectFont
182 | lgf_Title.textAlignment = .center
183 |
184 | // 副标 Label 配置
185 | if lgf_Style.lgf_IsDoubleTitle {
186 | lgf_SubTitle.textColor = lgf_Style.lgf_UnSubTitleSelectColor
187 | lgf_SubTitle.font = lgf_Style.lgf_UnSubTitleSelectFont
188 | lgf_SubTitle.textAlignment = .center
189 | }
190 |
191 | // 如果设置了都是相同标图片, 那么就强制转成全部相同图片
192 | if lgf_Style.lgf_SameSelectImageName.count > 0 && lgf_Style.lgf_SameUnSelectImageName.count > 0 {
193 | lgf_Style.lgf_Titles.forEach { _ in
194 | lgf_SelectImageNames.append(lgf_Style.lgf_SameSelectImageName)
195 | lgf_UnSelectImageNames.append(lgf_Style.lgf_SameUnSelectImageName)
196 | }
197 | lgf_Style.lgf_SelectImageNames = lgf_SelectImageNames
198 | lgf_Style.lgf_UnSelectImageNames = lgf_UnSelectImageNames
199 | }
200 |
201 | // 是否需要显示标图片
202 | if (lgf_Style.lgf_SelectImageNames.count < lgf_Style.lgf_Titles.count) || (lgf_Style.lgf_UnSelectImageNames.count < lgf_Style.lgf_Titles.count) {
203 | lgf_IsHaveImage = false
204 | lgf_TopImage.isHidden = true
205 | lgf_BottomImage.isHidden = true
206 | lgf_LeftImage.isHidden = true
207 | lgf_RightImage.isHidden = true
208 | lgf_TopImageHeight.constant = 0.0
209 | lgf_BottomImageHeight.constant = 0.0
210 | lgf_LeftImageWidth.constant = 0.0
211 | lgf_RightImageWidth.constant = 0.0
212 | lgf_TopImageSpace.constant = 0.0
213 | lgf_BottomImageSpace.constant = 0.0
214 | lgf_LeftImageSpace.constant = 0.0
215 | lgf_RightImageSpace.constant = 0.0
216 | return
217 | }
218 |
219 | lgf_IsHaveImage = true
220 |
221 | // 只要有宽度,允许设置左图片
222 | if lgf_Style.lgf_LeftImageWidth > 0.0 {
223 | lgf_LeftImage.isHidden = false
224 | lgf_LeftImage.contentMode = lgf_Style.lgf_TitleImageContentMode
225 | lgf_LeftImageSpace.constant = lgf_Style.lgf_LeftImageSpace
226 | lgf_LeftImageWidth.constant = min(lgf_Style.lgf_LeftImageWidth, lgf_Style.lgf_PVTitleView.lgfpt_Height)
227 | lgf_LeftImageHeight.constant = min(lgf_Style.lgf_LeftImageHeight, lgf_Style.lgf_PVTitleView.lgfpt_Height)
228 | if lgf_Style.lgf_IsNetImage {
229 | lgf_SwiftPTTitleDelegate?.lgf_GetTitleNetImage(lgf_LeftImage, URL.init(string: lgf_Style.lgf_UnSelectImageNames[tag]))
230 | } else {
231 | lgf_LeftImage.image = UIImage.init(named: lgf_Style.lgf_UnSelectImageNames[tag], in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
232 | }
233 | lgf_TitleCenterX.constant = lgf_TitleCenterX.constant + (lgf_Style.lgf_LeftImageWidth / 2)
234 | if lgf_Style.lgf_LeftImageSpace > 0.0 {
235 | lgf_TitleCenterX.constant = lgf_TitleCenterX.constant + (lgf_Style.lgf_LeftImageSpace / 2)
236 | }
237 | } else {
238 | debugPrint("🤖️:如果要显示左边图标,请给 left_image_width 赋值")
239 | }
240 |
241 | // 只要有宽度,允许设置右图片
242 | if lgf_Style.lgf_RightImageWidth > 0.0 {
243 | lgf_RightImage.isHidden = false
244 | lgf_RightImage.contentMode = lgf_Style.lgf_TitleImageContentMode
245 | lgf_RightImageSpace.constant = lgf_Style.lgf_RightImageSpace
246 | lgf_RightImageWidth.constant = min(lgf_Style.lgf_RightImageWidth, lgf_Style.lgf_PVTitleView.lgfpt_Height)
247 | lgf_RightImageHeight.constant = min(lgf_Style.lgf_RightImageHeight, lgf_Style.lgf_PVTitleView.lgfpt_Height)
248 | if lgf_Style.lgf_IsNetImage {
249 | lgf_SwiftPTTitleDelegate?.lgf_GetTitleNetImage(lgf_RightImage, URL.init(string: lgf_Style.lgf_UnSelectImageNames[tag]))
250 | } else {
251 | lgf_RightImage.image = UIImage.init(named: lgf_Style.lgf_UnSelectImageNames[tag], in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
252 | }
253 | lgf_TitleCenterX.constant = lgf_TitleCenterX.constant - (lgf_Style.lgf_RightImageWidth / 2.0)
254 | if lgf_Style.lgf_RightImageSpace > 0.0 {
255 | lgf_TitleCenterX.constant = lgf_TitleCenterX.constant - (lgf_Style.lgf_RightImageSpace / 2.0)
256 | }
257 | } else {
258 | debugPrint("🤖️:如果要显示右边图标,请给 right_image_width 赋值")
259 | }
260 |
261 | // 只要有高度,允许设置上图片
262 | if lgf_Style.lgf_TopImageHeight > 0.0 {
263 | lgf_TopImage.isHidden = false
264 | lgf_TopImage.contentMode = lgf_Style.lgf_TitleImageContentMode
265 | lgf_TopImageSpace.constant = lgf_Style.lgf_TopImageSpace
266 | lgf_TopImageWidth.constant = min(lgf_Style.lgf_TopImageWidth, lgf_Style.lgf_PVTitleView.lgfpt_Width)
267 | lgf_TopImageHeight.constant = min(lgf_Style.lgf_TopImageHeight, lgf_Style.lgf_PVTitleView.lgfpt_Height)
268 | if lgf_Style.lgf_IsNetImage {
269 | lgf_SwiftPTTitleDelegate?.lgf_GetTitleNetImage(lgf_TopImage, URL.init(string: lgf_Style.lgf_UnSelectImageNames[tag]))
270 | } else {
271 | lgf_TopImage.image = UIImage.init(named: lgf_Style.lgf_UnSelectImageNames[tag], in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
272 | }
273 | lgf_TitleCenterY.constant = lgf_TitleCenterY.constant + (lgf_Style.lgf_TopImageHeight / 2.0)
274 | if lgf_Style.lgf_TopImageSpace > 0.0 {
275 | lgf_TitleCenterY.constant = lgf_TitleCenterY.constant + (lgf_Style.lgf_TopImageSpace / 2.0)
276 | }
277 | } else {
278 | debugPrint("🤖️:如果要显示顶部图标,请给 top_image_height 赋值")
279 | }
280 |
281 | // 只要有高度,允许设置下图片
282 | if lgf_Style.lgf_BottomImageHeight > 0.0 {
283 | lgf_BottomImage.isHidden = false
284 | lgf_BottomImage.contentMode = lgf_Style.lgf_TitleImageContentMode
285 | lgf_BottomImageSpace.constant = lgf_Style.lgf_BottomImageSpace
286 | lgf_BottomImageWidth.constant = min(lgf_Style.lgf_BottomImageWidth, lgf_Style.lgf_PVTitleView.lgfpt_Width)
287 | lgf_BottomImageHeight.constant = min(lgf_Style.lgf_BottomImageHeight, lgf_Style.lgf_PVTitleView.lgfpt_Height)
288 | if lgf_Style.lgf_IsNetImage {
289 | lgf_SwiftPTTitleDelegate?.lgf_GetTitleNetImage(lgf_BottomImage, URL.init(string: lgf_Style.lgf_UnSelectImageNames[tag]))
290 | } else {
291 | lgf_BottomImage.image = UIImage.init(named: lgf_Style.lgf_UnSelectImageNames[tag], in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
292 | }
293 | lgf_TitleCenterY.constant = lgf_TitleCenterY.constant - (lgf_Style.lgf_BottomImageHeight / 2.0)
294 | if lgf_Style.lgf_BottomImageSpace > 0.0 {
295 | lgf_TitleCenterY.constant = lgf_TitleCenterY.constant - (lgf_Style.lgf_BottomImageSpace / 2.0)
296 | }
297 | } else {
298 | debugPrint("🤖️:如果要显示底部图标,请给 bottom_image_height 赋值")
299 | }
300 | }
301 | }
302 |
303 | // MARK: - 标初始化
304 | /// - Parameters:
305 | /// - titleText: 标文字
306 | /// - index: 在 LGFSwiftPT 中的位置下标
307 | /// - style: LGFSwiftPTStyle
308 | /// - delegate: LGFSwiftPTTitle
309 | class func lgf_AllocTitle(_ titleText: String, _ index: Int,_ style: LGFSwiftPTStyle!, _ delegate: LGFSwiftPTTitleDelegate) -> LGFSwiftPTTitle {
310 | // 初始化标
311 | let title = LGFSwiftPTStyle.LGFPTBundle.loadNibNamed(String(describing: LGFSwiftPTTitle.self.classForCoder()), owner: self, options: nil)?.first as! LGFSwiftPTTitle
312 | title.tag = index
313 | title.lgf_SwiftPTTitleDelegate = delegate
314 | title.lgf_Style = style
315 |
316 | // 开启调试模式所有背景将设置随机颜色方便调试
317 | if title.lgf_Style.lgf_StartDebug {
318 | title.backgroundColor = UIColor.lgfpt_RandomColor()
319 | title.lgf_Title.backgroundColor = UIColor.lgfpt_RandomColor()
320 | title.lgf_SubTitle.backgroundColor = UIColor.lgfpt_RandomColor()
321 | title.lgf_LeftImage.backgroundColor = UIColor.lgfpt_RandomColor()
322 | title.lgf_RightImage.backgroundColor = UIColor.lgfpt_RandomColor()
323 | title.lgf_TopImage.backgroundColor = UIColor.lgfpt_RandomColor()
324 | title.lgf_BottomImage.backgroundColor = UIColor.lgfpt_RandomColor()
325 | }
326 |
327 | // 分割线配置
328 | if title.lgf_Style.lgf_IsHaveCenterLine {
329 | title.lgf_CenterLine.isHidden = index == title.lgf_Style.lgf_Titles.count - 1
330 | title.lgf_CenterLine.backgroundColor = title.lgf_Style.lgf_CenterLineColor
331 | title.lgf_CenterLineWidth.constant = title.lgf_Style.lgf_CenterLineSize.width
332 | title.lgf_CenterLineHeight.constant = title.lgf_Style.lgf_CenterLineSize.height
333 | title.lgf_CenterLineX.constant = title.lgf_Style.lgf_CenterLineCenter.x - (title.lgf_Style.lgf_CenterLineSize.width / 2.0)
334 | title.lgf_CenterLineY.constant = title.lgf_Style.lgf_CenterLineCenter.y
335 | title.lgf_SwiftPTTitleDelegate?.lgf_GetCenterLine(title.lgf_CenterLine, index, title.lgf_Style, title.lgf_CenterLineX, title.lgf_CenterLineY, title.lgf_CenterLineWidth, title.lgf_CenterLineHeight)
336 | }
337 |
338 | // 需要显示子标题
339 | if title.lgf_Style.lgf_IsDoubleTitle {
340 | title.lgf_Title.text = titleText.components(separatedBy: "~~~").first
341 | title.lgf_SubTitle.text = titleText.components(separatedBy: "~~~").last
342 | } else {
343 | title.lgf_Title.text = titleText
344 | }
345 |
346 | // 获取字体宽度
347 | title.lgf_Title.adjustsFontSizeToFitWidth = true
348 | let titleSize: CGSize = title.lgf_Title.text?.lgfpt_TextSizeWithFont(font: title.lgf_Style.lgf_TitleSelectFont.pointSize > title.lgf_Style.lgf_UnTitleSelectFont.pointSize ? title.lgf_Style.lgf_TitleSelectFont : title.lgf_Style.lgf_UnTitleSelectFont, constrainedToSize: CGSize.init(width: CGFloat.greatestFiniteMagnitude, height: title.lgf_Style.lgf_PVTitleView.lgfpt_Height)) ?? .zero
349 | var subTitleSize: CGSize = .zero
350 | if title.lgf_Style.lgf_IsDoubleTitle {
351 | title.lgf_SubTitle.adjustsFontSizeToFitWidth = true
352 | subTitleSize = title.lgf_SubTitle.text?.lgfpt_TextSizeWithFont(font: title.lgf_Style.lgf_SubTitleSelectFont.pointSize > title.lgf_Style.lgf_UnSubTitleSelectFont.pointSize ? title.lgf_Style.lgf_SubTitleSelectFont : title.lgf_Style.lgf_UnSubTitleSelectFont, constrainedToSize: CGSize.init(width: CGFloat.greatestFiniteMagnitude, height: title.lgf_Style.lgf_PVTitleView.lgfpt_Height)) ?? .zero
353 | title.lgf_SubTitleHeight.constant = subTitleSize.height
354 | title.lgf_TitleCenterY.constant = title.lgf_TitleCenterY.constant - subTitleSize.height / 2.0 - title.lgf_Style.lgf_SubTitleTopSpace / 2.0
355 | title.lgf_SubTitleTop.constant = title.lgf_Style.lgf_SubTitleTopSpace
356 | title.lgf_SubTitleWidth.constant = subTitleSize.width
357 | }
358 | title.lgf_TitleWidth.constant = titleSize.width
359 | title.lgf_TitleHeight.constant = titleSize.height
360 |
361 | // 标 X
362 | var titleX: CGFloat = 0.0
363 | if index > 0 {
364 | let subview = title.lgf_Style.lgf_PVTitleView.subviews[index - 1]
365 | titleX = subview.lgfpt_X + subview.lgfpt_Width
366 | } else {
367 | titleX = title.lgf_Style.lgf_PageLeftRightSpace
368 | }
369 |
370 | // 标宽度
371 | let maxWidth = max(titleSize.width, subTitleSize.width)
372 | let leftRightSpace = style.lgf_TitleLeftRightSpace * 2.0
373 | let totalWidth = maxWidth + title.lgf_Style.lgf_LeftImageWidth + title.lgf_Style.lgf_RightImageWidth + title.lgf_Style.lgf_LeftImageSpace + title.lgf_Style.lgf_RightImageSpace + leftRightSpace
374 | let titleWidth = title.lgf_Style.lgf_TitleFixedWidth > 0.0 ? title.lgf_Style.lgf_TitleFixedWidth : totalWidth
375 | title.frame = CGRect.init(x: titleX, y: 0.0, width: titleWidth, height: title.lgf_Style.lgf_PVTitleView.lgfpt_Height)
376 | title.lgf_Style.lgf_PVTitleView.addSubview(title)
377 |
378 | // 根据特殊 title 数组 和 特殊 title 的 tag 判断某个 index 是否要替换特殊 title
379 | if style.lgf_SwiftPTSpecialTitleArray.count > 0 {
380 | style.lgf_SwiftPTSpecialTitleArray.forEach {
381 | let propertyArray = $0.lgfpt_SwiftPTSpecialTitleProperty?.components(separatedBy: "~~~")
382 | if propertyArray!.count == 2 {
383 | let specialTitleIndex = Int(propertyArray!.first ?? "0")
384 | if index == specialTitleIndex {
385 | title.lgfpt_Width = CGFloat(Int(propertyArray!.last ?? "0") ?? 0)
386 | $0.frame = title.bounds
387 | title.addSubview($0)
388 | }
389 | }
390 | }
391 | }
392 | // 这个代理放在最下面,对一些 LGFSwiftPTStyle 配置的属性拥有最终修改权
393 | title.lgf_SwiftPTTitleDelegate?.lgf_GetTitle(title, index, style)
394 | return title
395 | }
396 |
397 | // MARK: - 标整体状态改变 核心逻辑部分
398 | /// - Parameters:
399 | /// - progress: 外部 progress
400 | /// - isSelectTitle: 是否是要选中的 LGFSwiftPTTitle
401 | /// - selectIndex: 选中的 index
402 | /// - unselectIndex: 未选中的 index
403 | func lgf_SetMainTitleTransform(_ progress: CGFloat, _ isSelectTitle: Bool, _ selectIndex: Int, _ unselectIndex: Int) {
404 | let deltaScale = lgf_Style.lgf_TitleTransformSX - 1.0
405 | let mainTitleDeltaScale = lgf_Style.lgf_MainTitleTransformSX - 1.0
406 | let subTitleDeltaScale = lgf_Style.lgf_SubTitleTransformSX - 1.0
407 |
408 | if isSelectTitle {
409 | lgf_CurrentTransformSX = 1.0 + deltaScale * progress
410 | lgf_MainTitleCurrentTransformSX = 1.0 + mainTitleDeltaScale * progress
411 | lgf_MainTitleCurrentTransformTY = lgf_Style.lgf_MainTitleTransformTY * progress
412 | lgf_MainTitleCurrentTransformTX = lgf_Style.lgf_MainTitleTransformTX * progress
413 | lgf_SubTitleCurrentTransformSX = 1.0 + subTitleDeltaScale * progress
414 | lgf_SubTitleCurrentTransformTY = lgf_Style.lgf_SubTitleTransformTY * progress
415 | lgf_SubTitleCurrentTransformTX = lgf_Style.lgf_SubTitleTransformTX * progress
416 | } else {
417 | lgf_CurrentTransformSX = lgf_Style.lgf_TitleTransformSX - deltaScale * progress
418 | lgf_MainTitleCurrentTransformSX = lgf_Style.lgf_MainTitleTransformSX - mainTitleDeltaScale * progress
419 | lgf_MainTitleCurrentTransformTY = lgf_Style.lgf_MainTitleTransformTY - lgf_Style.lgf_MainTitleTransformTY * progress
420 | lgf_MainTitleCurrentTransformTX = lgf_Style.lgf_MainTitleTransformTX - lgf_Style.lgf_MainTitleTransformTX * progress
421 | lgf_SubTitleCurrentTransformSX = lgf_Style.lgf_SubTitleTransformSX - subTitleDeltaScale * progress
422 | lgf_SubTitleCurrentTransformTY = lgf_Style.lgf_SubTitleTransformTY - lgf_Style.lgf_SubTitleTransformTY * progress
423 | lgf_SubTitleCurrentTransformTX = lgf_Style.lgf_SubTitleTransformTX - lgf_Style.lgf_SubTitleTransformTX * progress
424 | }
425 |
426 | transform = CGAffineTransform.init(scaleX: lgf_CurrentTransformSX, y: lgf_CurrentTransformSX)
427 | lgf_Title.transform = CGAffineTransform.identity
428 | lgf_Title.transform = CGAffineTransform.init(scaleX: lgf_MainTitleCurrentTransformSX, y: lgf_MainTitleCurrentTransformSX)
429 | lgf_Title.transform = lgf_Title.transform.translatedBy(x: lgf_MainTitleCurrentTransformTX, y: lgf_MainTitleCurrentTransformTY)
430 |
431 | lgf_SubTitle.transform = CGAffineTransform.identity
432 | lgf_SubTitle.transform = CGAffineTransform.init(scaleX: lgf_SubTitleCurrentTransformSX, y: lgf_SubTitleCurrentTransformSX)
433 | lgf_SubTitle.transform = lgf_SubTitle.transform.translatedBy(x: lgf_SubTitleCurrentTransformTX, y: lgf_SubTitleCurrentTransformTY)
434 |
435 | lgf_CenterLine.transform = CGAffineTransform.init(scaleX: 1.0 / lgf_CurrentTransformSX, y: 1.0 / lgf_CurrentTransformSX)
436 |
437 | // 标颜色渐变
438 | if lgf_Style.lgf_TitleSelectColor != lgf_Style.lgf_UnTitleSelectColor {
439 | let colors = isSelectTitle ? lgf_UnSelectColorRGBA : lgf_SelectColorRGBA
440 | lgf_Title.textColor = UIColor.init(red: colors[0] - (isSelectTitle ? lgf_DeltaRGBA[0] : -lgf_DeltaRGBA[0]) * progress, green: colors[1] - (isSelectTitle ? lgf_DeltaRGBA[1] : -lgf_DeltaRGBA[1]) * progress, blue: colors[2] - (isSelectTitle ? lgf_DeltaRGBA[2] : -lgf_DeltaRGBA[2]) * progress, alpha: colors[3] - (isSelectTitle ? lgf_DeltaRGBA[3] : -lgf_DeltaRGBA[3]) * progress)
441 | }
442 | if lgf_Style.lgf_IsDoubleTitle && lgf_Style.lgf_SubTitleSelectColor != lgf_Style.lgf_UnSubTitleSelectColor {
443 | let colors = isSelectTitle ? lgf_SubUnSelectColorRGBA : lgf_SubSelectColorRGBA
444 | lgf_SubTitle.textColor = UIColor.init(red: colors[0] - (isSelectTitle ? lgf_SubDeltaRGBA[0] : -lgf_SubDeltaRGBA[0]) * progress, green: colors[1] - (isSelectTitle ? lgf_SubDeltaRGBA[1] : -lgf_SubDeltaRGBA[1]) * progress, blue: colors[2] - (isSelectTitle ? lgf_SubDeltaRGBA[2] : -lgf_SubDeltaRGBA[2]) * progress, alpha: colors[3] - (isSelectTitle ? lgf_SubDeltaRGBA[3] : -lgf_SubDeltaRGBA[3]) * progress)
445 | }
446 |
447 | // 字体改变
448 | if !(lgf_Style.lgf_TitleSelectFont == lgf_Style.lgf_UnTitleSelectFont) {
449 | lgf_Title.font = (isSelectTitle == (progress > 0.5)) ? lgf_Style.lgf_TitleSelectFont : lgf_Style.lgf_UnTitleSelectFont
450 | }
451 | if lgf_Style.lgf_IsDoubleTitle {
452 | if !(lgf_Style.lgf_SubTitleSelectFont == lgf_Style.lgf_UnSubTitleSelectFont) {
453 | lgf_SubTitle.font = (isSelectTitle == (progress > 0.5)) ? lgf_Style.lgf_SubTitleSelectFont : lgf_Style.lgf_UnSubTitleSelectFont
454 | }
455 | }
456 |
457 | // 图标选中
458 | if lgf_Style.lgf_SelectImageNames.count > 0 && lgf_Style.lgf_UnSelectImageNames.count > 0 {
459 | let ssImageName = lgf_Style.lgf_SelectImageNames[selectIndex]
460 | let uuImageName = lgf_Style.lgf_UnSelectImageNames[unselectIndex]
461 | let usImageName = lgf_Style.lgf_UnSelectImageNames[selectIndex]
462 | let suImageName = lgf_Style.lgf_SelectImageNames[unselectIndex]
463 | let imageName = (isSelectTitle ? (progress > 0.5 ? ssImageName : usImageName) : (progress > 0.5 ? uuImageName : suImageName))
464 | if lgf_Style.lgf_LeftImageWidth > 0.0 && lgf_Style.lgf_LeftImageHeight > 0.0 {
465 | if lgf_Style.lgf_IsNetImage {
466 | lgf_SwiftPTTitleDelegate?.lgf_GetTitleNetImage(lgf_LeftImage, URL.init(string: imageName))
467 | } else {
468 | lgf_LeftImage.image = UIImage.init(named: imageName, in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
469 | }
470 | }
471 | if lgf_Style.lgf_RightImageWidth > 0.0 && lgf_Style.lgf_RightImageHeight > 0.0 {
472 | if lgf_Style.lgf_IsNetImage {
473 | lgf_SwiftPTTitleDelegate?.lgf_GetTitleNetImage(lgf_RightImage, URL.init(string: imageName))
474 | } else {
475 | lgf_RightImage.image = UIImage.init(named: imageName, in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
476 | }
477 | }
478 | if lgf_Style.lgf_TopImageHeight > 0.0 && lgf_Style.lgf_TopImageWidth > 0.0 {
479 | if lgf_Style.lgf_IsNetImage {
480 | lgf_SwiftPTTitleDelegate?.lgf_GetTitleNetImage(lgf_TopImage, URL.init(string: imageName))
481 | } else {
482 | lgf_TopImage.image = UIImage.init(named: imageName, in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
483 | }
484 | }
485 | if lgf_Style.lgf_BottomImageHeight > 0.0 && lgf_Style.lgf_BottomImageWidth > 0.0 {
486 | if lgf_Style.lgf_IsNetImage {
487 | lgf_SwiftPTTitleDelegate?.lgf_GetTitleNetImage(lgf_BottomImage, URL.init(string: imageName))
488 | } else {
489 | lgf_BottomImage.image = UIImage.init(named: imageName, in: lgf_Style.lgf_ImageBundel, compatibleWith: nil)
490 | }
491 | }
492 | }
493 | }
494 |
495 | deinit {
496 | debugPrint("🤖️:LGFSwiftPTTitle --- 已释放 ✈️")
497 | }
498 |
499 | }
500 |
--------------------------------------------------------------------------------
/LGFSwiftPT/LGFSwiftPTTitle.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
26 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 2B1055832351D80700CD5B1A /* LGFSwiftPT.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 2B1055822351D80700CD5B1A /* LGFSwiftPT.podspec */; };
11 | 2B21887C235CAEE20038BDE3 /* VerticalViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B21887B235CAEE20038BDE3 /* VerticalViewController.storyboard */; };
12 | 2B21887E235CAF160038BDE3 /* VerticalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B21887D235CAF160038BDE3 /* VerticalViewController.swift */; };
13 | 2B218881235CAF4A0038BDE3 /* VerticalViewControllerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B218880235CAF4A0038BDE3 /* VerticalViewControllerCell.swift */; };
14 | 2B218883235CAF730038BDE3 /* VerticalViewControllerReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B218882235CAF730038BDE3 /* VerticalViewControllerReusableView.swift */; };
15 | 2B218885235CAF880038BDE3 /* VerticalViewControllerOneCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B218884235CAF880038BDE3 /* VerticalViewControllerOneCell.swift */; };
16 | 2B218887235CAF980038BDE3 /* VerticalViewControllerThreeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B218886235CAF980038BDE3 /* VerticalViewControllerThreeCell.swift */; };
17 | 2B21888B235CB8660038BDE3 /* LGF+UIDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B218889235CB8660038BDE3 /* LGF+UIDevice.swift */; };
18 | 2B21888C235CB8660038BDE3 /* LGF+UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B21888A235CB8660038BDE3 /* LGF+UIColor.swift */; };
19 | 2B218892235D57820038BDE3 /* Toast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B218891235D57810038BDE3 /* Toast.swift */; };
20 | 2B394E86234F44660067AD69 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B394E85234F44660067AD69 /* AppDelegate.swift */; };
21 | 2B394E88234F44660067AD69 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B394E87234F44660067AD69 /* ViewController.swift */; };
22 | 2B394E8B234F44660067AD69 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B394E89234F44660067AD69 /* Main.storyboard */; };
23 | 2B394E8D234F44660067AD69 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2B394E8C234F44660067AD69 /* Assets.xcassets */; };
24 | 2B394E90234F44660067AD69 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B394E8E234F44660067AD69 /* LaunchScreen.storyboard */; };
25 | 2B394EC7234F45780067AD69 /* LGFSwiftPTFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B394EBE234F45780067AD69 /* LGFSwiftPTFlowLayout.swift */; };
26 | 2B394EC8234F45780067AD69 /* LGFSwiftPTLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B394EBF234F45780067AD69 /* LGFSwiftPTLine.swift */; };
27 | 2B394EC9234F45780067AD69 /* LGFSwiftPTTitle.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B394EC0234F45780067AD69 /* LGFSwiftPTTitle.xib */; };
28 | 2B394ECA234F45780067AD69 /* LGFSwiftPTMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B394EC1234F45780067AD69 /* LGFSwiftPTMethod.swift */; };
29 | 2B394ECB234F45780067AD69 /* LGFSwiftPT.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B394EC2234F45780067AD69 /* LGFSwiftPT.xib */; };
30 | 2B394ECC234F45780067AD69 /* LGFSwiftPTLine.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B394EC3234F45780067AD69 /* LGFSwiftPTLine.xib */; };
31 | 2B394ECD234F45780067AD69 /* LGFSwiftPTTitle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B394EC4234F45780067AD69 /* LGFSwiftPTTitle.swift */; };
32 | 2B394ECE234F45780067AD69 /* LGFSwiftPTStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B394EC5234F45780067AD69 /* LGFSwiftPTStyle.swift */; };
33 | 2B394ECF234F45780067AD69 /* LGFSwiftPT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B394EC6234F45780067AD69 /* LGFSwiftPT.swift */; };
34 | /* End PBXBuildFile section */
35 |
36 | /* Begin PBXFileReference section */
37 | 2B1055822351D80700CD5B1A /* LGFSwiftPT.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LGFSwiftPT.podspec; sourceTree = SOURCE_ROOT; };
38 | 2B21887B235CAEE20038BDE3 /* VerticalViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = VerticalViewController.storyboard; sourceTree = ""; };
39 | 2B21887D235CAF160038BDE3 /* VerticalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerticalViewController.swift; sourceTree = ""; };
40 | 2B218880235CAF4A0038BDE3 /* VerticalViewControllerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerticalViewControllerCell.swift; sourceTree = ""; };
41 | 2B218882235CAF730038BDE3 /* VerticalViewControllerReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerticalViewControllerReusableView.swift; sourceTree = ""; };
42 | 2B218884235CAF880038BDE3 /* VerticalViewControllerOneCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerticalViewControllerOneCell.swift; sourceTree = ""; };
43 | 2B218886235CAF980038BDE3 /* VerticalViewControllerThreeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerticalViewControllerThreeCell.swift; sourceTree = ""; };
44 | 2B218889235CB8660038BDE3 /* LGF+UIDevice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "LGF+UIDevice.swift"; sourceTree = ""; };
45 | 2B21888A235CB8660038BDE3 /* LGF+UIColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "LGF+UIColor.swift"; sourceTree = ""; };
46 | 2B218891235D57810038BDE3 /* Toast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = ""; };
47 | 2B394E82234F44660067AD69 /* LGFSwiftPTDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LGFSwiftPTDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
48 | 2B394E85234F44660067AD69 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
49 | 2B394E87234F44660067AD69 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
50 | 2B394E8A234F44660067AD69 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
51 | 2B394E8C234F44660067AD69 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
52 | 2B394E8F234F44660067AD69 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
53 | 2B394E91234F44660067AD69 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
54 | 2B394EBE234F45780067AD69 /* LGFSwiftPTFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LGFSwiftPTFlowLayout.swift; sourceTree = ""; };
55 | 2B394EBF234F45780067AD69 /* LGFSwiftPTLine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LGFSwiftPTLine.swift; sourceTree = ""; };
56 | 2B394EC0234F45780067AD69 /* LGFSwiftPTTitle.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LGFSwiftPTTitle.xib; sourceTree = ""; };
57 | 2B394EC1234F45780067AD69 /* LGFSwiftPTMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LGFSwiftPTMethod.swift; sourceTree = ""; };
58 | 2B394EC2234F45780067AD69 /* LGFSwiftPT.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LGFSwiftPT.xib; sourceTree = ""; };
59 | 2B394EC3234F45780067AD69 /* LGFSwiftPTLine.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LGFSwiftPTLine.xib; sourceTree = ""; };
60 | 2B394EC4234F45780067AD69 /* LGFSwiftPTTitle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LGFSwiftPTTitle.swift; sourceTree = ""; };
61 | 2B394EC5234F45780067AD69 /* LGFSwiftPTStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LGFSwiftPTStyle.swift; sourceTree = ""; };
62 | 2B394EC6234F45780067AD69 /* LGFSwiftPT.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LGFSwiftPT.swift; sourceTree = ""; };
63 | /* End PBXFileReference section */
64 |
65 | /* Begin PBXFrameworksBuildPhase section */
66 | 2B394E7F234F44660067AD69 /* Frameworks */ = {
67 | isa = PBXFrameworksBuildPhase;
68 | buildActionMask = 2147483647;
69 | files = (
70 | );
71 | runOnlyForDeploymentPostprocessing = 0;
72 | };
73 | /* End PBXFrameworksBuildPhase section */
74 |
75 | /* Begin PBXGroup section */
76 | 2B21887A235CAEB30038BDE3 /* 支付宝编辑页效果 */ = {
77 | isa = PBXGroup;
78 | children = (
79 | 2B21887F235CAF2B0038BDE3 /* View */,
80 | 2B21887D235CAF160038BDE3 /* VerticalViewController.swift */,
81 | 2B21887B235CAEE20038BDE3 /* VerticalViewController.storyboard */,
82 | );
83 | path = "支付宝编辑页效果";
84 | sourceTree = "";
85 | };
86 | 2B21887F235CAF2B0038BDE3 /* View */ = {
87 | isa = PBXGroup;
88 | children = (
89 | 2B218880235CAF4A0038BDE3 /* VerticalViewControllerCell.swift */,
90 | 2B218882235CAF730038BDE3 /* VerticalViewControllerReusableView.swift */,
91 | 2B218884235CAF880038BDE3 /* VerticalViewControllerOneCell.swift */,
92 | 2B218886235CAF980038BDE3 /* VerticalViewControllerThreeCell.swift */,
93 | );
94 | path = View;
95 | sourceTree = "";
96 | };
97 | 2B218888235CB84E0038BDE3 /* Tool */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 2B218891235D57810038BDE3 /* Toast.swift */,
101 | 2B21888A235CB8660038BDE3 /* LGF+UIColor.swift */,
102 | 2B218889235CB8660038BDE3 /* LGF+UIDevice.swift */,
103 | );
104 | path = Tool;
105 | sourceTree = "";
106 | };
107 | 2B394E79234F44660067AD69 = {
108 | isa = PBXGroup;
109 | children = (
110 | 2B1055822351D80700CD5B1A /* LGFSwiftPT.podspec */,
111 | 2B394EBD234F45780067AD69 /* LGFSwiftPT */,
112 | 2B394E84234F44660067AD69 /* LGFSwiftPTDemo */,
113 | 2B394E83234F44660067AD69 /* Products */,
114 | );
115 | sourceTree = "";
116 | };
117 | 2B394E83234F44660067AD69 /* Products */ = {
118 | isa = PBXGroup;
119 | children = (
120 | 2B394E82234F44660067AD69 /* LGFSwiftPTDemo.app */,
121 | );
122 | name = Products;
123 | sourceTree = "";
124 | };
125 | 2B394E84234F44660067AD69 /* LGFSwiftPTDemo */ = {
126 | isa = PBXGroup;
127 | children = (
128 | 2B218888235CB84E0038BDE3 /* Tool */,
129 | 2B21887A235CAEB30038BDE3 /* 支付宝编辑页效果 */,
130 | 2B394E85234F44660067AD69 /* AppDelegate.swift */,
131 | 2B394E87234F44660067AD69 /* ViewController.swift */,
132 | 2B394E89234F44660067AD69 /* Main.storyboard */,
133 | 2B394E8C234F44660067AD69 /* Assets.xcassets */,
134 | 2B394E8E234F44660067AD69 /* LaunchScreen.storyboard */,
135 | 2B394E91234F44660067AD69 /* Info.plist */,
136 | );
137 | path = LGFSwiftPTDemo;
138 | sourceTree = "";
139 | };
140 | 2B394EBD234F45780067AD69 /* LGFSwiftPT */ = {
141 | isa = PBXGroup;
142 | children = (
143 | 2B394EBE234F45780067AD69 /* LGFSwiftPTFlowLayout.swift */,
144 | 2B394EC1234F45780067AD69 /* LGFSwiftPTMethod.swift */,
145 | 2B394EC5234F45780067AD69 /* LGFSwiftPTStyle.swift */,
146 | 2B394EC6234F45780067AD69 /* LGFSwiftPT.swift */,
147 | 2B394EC2234F45780067AD69 /* LGFSwiftPT.xib */,
148 | 2B394EBF234F45780067AD69 /* LGFSwiftPTLine.swift */,
149 | 2B394EC3234F45780067AD69 /* LGFSwiftPTLine.xib */,
150 | 2B394EC4234F45780067AD69 /* LGFSwiftPTTitle.swift */,
151 | 2B394EC0234F45780067AD69 /* LGFSwiftPTTitle.xib */,
152 | );
153 | path = LGFSwiftPT;
154 | sourceTree = "";
155 | };
156 | /* End PBXGroup section */
157 |
158 | /* Begin PBXNativeTarget section */
159 | 2B394E81234F44660067AD69 /* LGFSwiftPTDemo */ = {
160 | isa = PBXNativeTarget;
161 | buildConfigurationList = 2B394E94234F44660067AD69 /* Build configuration list for PBXNativeTarget "LGFSwiftPTDemo" */;
162 | buildPhases = (
163 | 2B394E7E234F44660067AD69 /* Sources */,
164 | 2B394E7F234F44660067AD69 /* Frameworks */,
165 | 2B394E80234F44660067AD69 /* Resources */,
166 | );
167 | buildRules = (
168 | );
169 | dependencies = (
170 | );
171 | name = LGFSwiftPTDemo;
172 | productName = LGFSwiftPTDemo;
173 | productReference = 2B394E82234F44660067AD69 /* LGFSwiftPTDemo.app */;
174 | productType = "com.apple.product-type.application";
175 | };
176 | /* End PBXNativeTarget section */
177 |
178 | /* Begin PBXProject section */
179 | 2B394E7A234F44660067AD69 /* Project object */ = {
180 | isa = PBXProject;
181 | attributes = {
182 | LastSwiftUpdateCheck = 1010;
183 | LastUpgradeCheck = 1010;
184 | ORGANIZATIONNAME = laiguofeng;
185 | TargetAttributes = {
186 | 2B394E81234F44660067AD69 = {
187 | CreatedOnToolsVersion = 10.1;
188 | LastSwiftMigration = 1010;
189 | };
190 | };
191 | };
192 | buildConfigurationList = 2B394E7D234F44660067AD69 /* Build configuration list for PBXProject "LGFSwiftPTDemo" */;
193 | compatibilityVersion = "Xcode 9.3";
194 | developmentRegion = en;
195 | hasScannedForEncodings = 0;
196 | knownRegions = (
197 | en,
198 | Base,
199 | );
200 | mainGroup = 2B394E79234F44660067AD69;
201 | productRefGroup = 2B394E83234F44660067AD69 /* Products */;
202 | projectDirPath = "";
203 | projectRoot = "";
204 | targets = (
205 | 2B394E81234F44660067AD69 /* LGFSwiftPTDemo */,
206 | );
207 | };
208 | /* End PBXProject section */
209 |
210 | /* Begin PBXResourcesBuildPhase section */
211 | 2B394E80234F44660067AD69 /* Resources */ = {
212 | isa = PBXResourcesBuildPhase;
213 | buildActionMask = 2147483647;
214 | files = (
215 | 2B394EC9234F45780067AD69 /* LGFSwiftPTTitle.xib in Resources */,
216 | 2B394ECC234F45780067AD69 /* LGFSwiftPTLine.xib in Resources */,
217 | 2B1055832351D80700CD5B1A /* LGFSwiftPT.podspec in Resources */,
218 | 2B21887C235CAEE20038BDE3 /* VerticalViewController.storyboard in Resources */,
219 | 2B394E90234F44660067AD69 /* LaunchScreen.storyboard in Resources */,
220 | 2B394ECB234F45780067AD69 /* LGFSwiftPT.xib in Resources */,
221 | 2B394E8D234F44660067AD69 /* Assets.xcassets in Resources */,
222 | 2B394E8B234F44660067AD69 /* Main.storyboard in Resources */,
223 | );
224 | runOnlyForDeploymentPostprocessing = 0;
225 | };
226 | /* End PBXResourcesBuildPhase section */
227 |
228 | /* Begin PBXSourcesBuildPhase section */
229 | 2B394E7E234F44660067AD69 /* Sources */ = {
230 | isa = PBXSourcesBuildPhase;
231 | buildActionMask = 2147483647;
232 | files = (
233 | 2B394ECF234F45780067AD69 /* LGFSwiftPT.swift in Sources */,
234 | 2B218892235D57820038BDE3 /* Toast.swift in Sources */,
235 | 2B394ECD234F45780067AD69 /* LGFSwiftPTTitle.swift in Sources */,
236 | 2B21887E235CAF160038BDE3 /* VerticalViewController.swift in Sources */,
237 | 2B394ECE234F45780067AD69 /* LGFSwiftPTStyle.swift in Sources */,
238 | 2B394E88234F44660067AD69 /* ViewController.swift in Sources */,
239 | 2B21888B235CB8660038BDE3 /* LGF+UIDevice.swift in Sources */,
240 | 2B218885235CAF880038BDE3 /* VerticalViewControllerOneCell.swift in Sources */,
241 | 2B394EC8234F45780067AD69 /* LGFSwiftPTLine.swift in Sources */,
242 | 2B394E86234F44660067AD69 /* AppDelegate.swift in Sources */,
243 | 2B218887235CAF980038BDE3 /* VerticalViewControllerThreeCell.swift in Sources */,
244 | 2B21888C235CB8660038BDE3 /* LGF+UIColor.swift in Sources */,
245 | 2B394EC7234F45780067AD69 /* LGFSwiftPTFlowLayout.swift in Sources */,
246 | 2B218881235CAF4A0038BDE3 /* VerticalViewControllerCell.swift in Sources */,
247 | 2B394ECA234F45780067AD69 /* LGFSwiftPTMethod.swift in Sources */,
248 | 2B218883235CAF730038BDE3 /* VerticalViewControllerReusableView.swift in Sources */,
249 | );
250 | runOnlyForDeploymentPostprocessing = 0;
251 | };
252 | /* End PBXSourcesBuildPhase section */
253 |
254 | /* Begin PBXVariantGroup section */
255 | 2B394E89234F44660067AD69 /* Main.storyboard */ = {
256 | isa = PBXVariantGroup;
257 | children = (
258 | 2B394E8A234F44660067AD69 /* Base */,
259 | );
260 | name = Main.storyboard;
261 | sourceTree = "";
262 | };
263 | 2B394E8E234F44660067AD69 /* LaunchScreen.storyboard */ = {
264 | isa = PBXVariantGroup;
265 | children = (
266 | 2B394E8F234F44660067AD69 /* Base */,
267 | );
268 | name = LaunchScreen.storyboard;
269 | sourceTree = "";
270 | };
271 | /* End PBXVariantGroup section */
272 |
273 | /* Begin XCBuildConfiguration section */
274 | 2B394E92234F44660067AD69 /* Debug */ = {
275 | isa = XCBuildConfiguration;
276 | buildSettings = {
277 | ALWAYS_SEARCH_USER_PATHS = NO;
278 | CLANG_ANALYZER_NONNULL = YES;
279 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
280 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
281 | CLANG_CXX_LIBRARY = "libc++";
282 | CLANG_ENABLE_MODULES = YES;
283 | CLANG_ENABLE_OBJC_ARC = YES;
284 | CLANG_ENABLE_OBJC_WEAK = YES;
285 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
286 | CLANG_WARN_BOOL_CONVERSION = YES;
287 | CLANG_WARN_COMMA = YES;
288 | CLANG_WARN_CONSTANT_CONVERSION = YES;
289 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
291 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
292 | CLANG_WARN_EMPTY_BODY = YES;
293 | CLANG_WARN_ENUM_CONVERSION = YES;
294 | CLANG_WARN_INFINITE_RECURSION = YES;
295 | CLANG_WARN_INT_CONVERSION = YES;
296 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
297 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
298 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
299 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
300 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
301 | CLANG_WARN_STRICT_PROTOTYPES = YES;
302 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
303 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
304 | CLANG_WARN_UNREACHABLE_CODE = YES;
305 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
306 | CODE_SIGN_IDENTITY = "iPhone Developer";
307 | COPY_PHASE_STRIP = NO;
308 | DEBUG_INFORMATION_FORMAT = dwarf;
309 | ENABLE_STRICT_OBJC_MSGSEND = YES;
310 | ENABLE_TESTABILITY = YES;
311 | GCC_C_LANGUAGE_STANDARD = gnu11;
312 | GCC_DYNAMIC_NO_PIC = NO;
313 | GCC_NO_COMMON_BLOCKS = YES;
314 | GCC_OPTIMIZATION_LEVEL = 0;
315 | GCC_PREPROCESSOR_DEFINITIONS = (
316 | "DEBUG=1",
317 | "$(inherited)",
318 | );
319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
321 | GCC_WARN_UNDECLARED_SELECTOR = YES;
322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
323 | GCC_WARN_UNUSED_FUNCTION = YES;
324 | GCC_WARN_UNUSED_VARIABLE = YES;
325 | IPHONEOS_DEPLOYMENT_TARGET = 12.1;
326 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
327 | MTL_FAST_MATH = YES;
328 | ONLY_ACTIVE_ARCH = YES;
329 | SDKROOT = iphoneos;
330 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
331 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
332 | };
333 | name = Debug;
334 | };
335 | 2B394E93234F44660067AD69 /* Release */ = {
336 | isa = XCBuildConfiguration;
337 | buildSettings = {
338 | ALWAYS_SEARCH_USER_PATHS = NO;
339 | CLANG_ANALYZER_NONNULL = YES;
340 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
341 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
342 | CLANG_CXX_LIBRARY = "libc++";
343 | CLANG_ENABLE_MODULES = YES;
344 | CLANG_ENABLE_OBJC_ARC = YES;
345 | CLANG_ENABLE_OBJC_WEAK = YES;
346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
347 | CLANG_WARN_BOOL_CONVERSION = YES;
348 | CLANG_WARN_COMMA = YES;
349 | CLANG_WARN_CONSTANT_CONVERSION = YES;
350 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
351 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
352 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
353 | CLANG_WARN_EMPTY_BODY = YES;
354 | CLANG_WARN_ENUM_CONVERSION = YES;
355 | CLANG_WARN_INFINITE_RECURSION = YES;
356 | CLANG_WARN_INT_CONVERSION = YES;
357 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
358 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
359 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
360 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
361 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
362 | CLANG_WARN_STRICT_PROTOTYPES = YES;
363 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
364 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
365 | CLANG_WARN_UNREACHABLE_CODE = YES;
366 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
367 | CODE_SIGN_IDENTITY = "iPhone Developer";
368 | COPY_PHASE_STRIP = NO;
369 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
370 | ENABLE_NS_ASSERTIONS = NO;
371 | ENABLE_STRICT_OBJC_MSGSEND = YES;
372 | GCC_C_LANGUAGE_STANDARD = gnu11;
373 | GCC_NO_COMMON_BLOCKS = YES;
374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
376 | GCC_WARN_UNDECLARED_SELECTOR = YES;
377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
378 | GCC_WARN_UNUSED_FUNCTION = YES;
379 | GCC_WARN_UNUSED_VARIABLE = YES;
380 | IPHONEOS_DEPLOYMENT_TARGET = 12.1;
381 | MTL_ENABLE_DEBUG_INFO = NO;
382 | MTL_FAST_MATH = YES;
383 | SDKROOT = iphoneos;
384 | SWIFT_COMPILATION_MODE = wholemodule;
385 | SWIFT_OPTIMIZATION_LEVEL = "-O";
386 | VALIDATE_PRODUCT = YES;
387 | };
388 | name = Release;
389 | };
390 | 2B394E95234F44660067AD69 /* Debug */ = {
391 | isa = XCBuildConfiguration;
392 | buildSettings = {
393 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
394 | CLANG_ENABLE_MODULES = YES;
395 | CODE_SIGN_IDENTITY = "iPhone Developer";
396 | CODE_SIGN_STYLE = Automatic;
397 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
398 | DEVELOPMENT_TEAM = YU3566C3NH;
399 | ENABLE_STRICT_OBJC_MSGSEND = NO;
400 | INFOPLIST_FILE = LGFSwiftPTDemo/Info.plist;
401 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
402 | LD_RUNPATH_SEARCH_PATHS = (
403 | "$(inherited)",
404 | "@executable_path/Frameworks",
405 | );
406 | MARKETING_VERSION = 0.0.7;
407 | PRODUCT_BUNDLE_IDENTIFIER = "laiguofeng.-LGFSwiftPT.LGFSwiftPTDemo";
408 | PRODUCT_NAME = "$(TARGET_NAME)";
409 | PROVISIONING_PROFILE_SPECIFIER = "";
410 | SWIFT_OBJC_BRIDGING_HEADER = "";
411 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
412 | SWIFT_VERSION = 4.2;
413 | TARGETED_DEVICE_FAMILY = "1,2";
414 | };
415 | name = Debug;
416 | };
417 | 2B394E96234F44660067AD69 /* Release */ = {
418 | isa = XCBuildConfiguration;
419 | buildSettings = {
420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
421 | CLANG_ENABLE_MODULES = YES;
422 | CODE_SIGN_IDENTITY = "iPhone Developer";
423 | CODE_SIGN_STYLE = Automatic;
424 | DEVELOPMENT_TEAM = YU3566C3NH;
425 | ENABLE_STRICT_OBJC_MSGSEND = NO;
426 | INFOPLIST_FILE = LGFSwiftPTDemo/Info.plist;
427 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
428 | LD_RUNPATH_SEARCH_PATHS = (
429 | "$(inherited)",
430 | "@executable_path/Frameworks",
431 | );
432 | MARKETING_VERSION = 0.0.7;
433 | PRODUCT_BUNDLE_IDENTIFIER = "laiguofeng.-LGFSwiftPT.LGFSwiftPTDemo";
434 | PRODUCT_NAME = "$(TARGET_NAME)";
435 | PROVISIONING_PROFILE_SPECIFIER = "";
436 | SWIFT_OBJC_BRIDGING_HEADER = "";
437 | SWIFT_VERSION = 4.2;
438 | TARGETED_DEVICE_FAMILY = "1,2";
439 | };
440 | name = Release;
441 | };
442 | /* End XCBuildConfiguration section */
443 |
444 | /* Begin XCConfigurationList section */
445 | 2B394E7D234F44660067AD69 /* Build configuration list for PBXProject "LGFSwiftPTDemo" */ = {
446 | isa = XCConfigurationList;
447 | buildConfigurations = (
448 | 2B394E92234F44660067AD69 /* Debug */,
449 | 2B394E93234F44660067AD69 /* Release */,
450 | );
451 | defaultConfigurationIsVisible = 0;
452 | defaultConfigurationName = Release;
453 | };
454 | 2B394E94234F44660067AD69 /* Build configuration list for PBXNativeTarget "LGFSwiftPTDemo" */ = {
455 | isa = XCConfigurationList;
456 | buildConfigurations = (
457 | 2B394E95234F44660067AD69 /* Debug */,
458 | 2B394E96234F44660067AD69 /* Release */,
459 | );
460 | defaultConfigurationIsVisible = 0;
461 | defaultConfigurationName = Release;
462 | };
463 | /* End XCConfigurationList section */
464 | };
465 | rootObject = 2B394E7A234F44660067AD69 /* Project object */;
466 | }
467 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo.xcodeproj/project.xcworkspace/xcuserdata/lai.xcuserdatad/IDEFindNavigatorScopes.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo.xcodeproj/xcshareddata/xcschemes/LGFSwiftPTDemo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
58 |
64 |
66 |
72 |
73 |
74 |
75 |
77 |
78 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // LGFSwiftPTDemo
4 | //
5 | // Created by 来 on 2019/10/10.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/AA收款.imageset/AA收款.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/AA收款.imageset/AA收款.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/AA收款.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "AA收款.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/diandian.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "diandian.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/diandian.imageset/diandian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/diandian.imageset/diandian.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/中小学.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "中小学.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/中小学.imageset/中小学.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/中小学.imageset/中小学.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/交通出行.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "交通出行.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/交通出行.imageset/交通出行.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/交通出行.imageset/交通出行.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/亲子账户.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "亲子账户.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/亲子账户.imageset/亲子账户.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/亲子账户.imageset/亲子账户.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/亲情号.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "亲情号.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/亲情号.imageset/亲情号.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/亲情号.imageset/亲情号.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/体育服务.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "体育服务.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/体育服务.imageset/体育服务.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/体育服务.imageset/体育服务.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/余额宝.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "余额宝.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/余额宝.imageset/余额宝.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/余额宝.imageset/余额宝.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/信用卡还款.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "信用卡还款.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/信用卡还款.imageset/信用卡还款.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/信用卡还款.imageset/信用卡还款.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/借呗.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "借呗.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/借呗.imageset/借呗.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/借呗.imageset/借呗.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/充值中心.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "充值中心.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/充值中心.imageset/充值中心.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/充值中心.imageset/充值中心.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/出境.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "出境.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/出境.imageset/出境.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/出境.imageset/出境.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/删除.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "删除.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/删除.imageset/删除.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/删除.imageset/删除.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/医疗健康.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "医疗健康.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/医疗健康.imageset/医疗健康.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/医疗健康.imageset/医疗健康.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/发票管家.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "发票管家.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/发票管家.imageset/发票管家.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/发票管家.imageset/发票管家.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/哈啰出行.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "哈啰出行.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/哈啰出行.imageset/哈啰出行.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/哈啰出行.imageset/哈啰出行.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/商家服务.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "商家服务.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/商家服务.imageset/商家服务.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/商家服务.imageset/商家服务.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/城市服务.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "城市服务.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/城市服务.imageset/城市服务.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/城市服务.imageset/城市服务.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/天猫.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "天猫.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/天猫.imageset/天猫.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/天猫.imageset/天猫.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/奖励金.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "奖励金.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/奖励金.imageset/奖励金.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/奖励金.imageset/奖励金.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/安全备忘.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "安全备忘.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/安全备忘.imageset/安全备忘.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/安全备忘.imageset/安全备忘.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/彩票.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "彩票.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/彩票.imageset/彩票.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/彩票.imageset/彩票.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/我的快递.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "我的快递.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/我的快递.imageset/我的快递.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/我的快递.imageset/我的快递.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/更多.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "更多.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/更多.imageset/更多.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/更多.imageset/更多.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/校园生活.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "校园生活.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/校园生活.imageset/校园生活.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/校园生活.imageset/校园生活.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/汇率换算.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "汇率换算.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/汇率换算.imageset/汇率换算.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/汇率换算.imageset/汇率换算.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/淘宝.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "淘宝.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/淘宝.imageset/淘宝.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/淘宝.imageset/淘宝.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/淘票票电影.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "淘票票.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/淘票票电影.imageset/淘票票.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/淘票票电影.imageset/淘票票.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/添加.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "添加.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/添加.imageset/添加.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/添加.imageset/添加.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/滴滴出行.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "嘀嘀出行.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/滴滴出行.imageset/嘀嘀出行.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/滴滴出行.imageset/嘀嘀出行.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/火车票机票.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "火车票机票.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/火车票机票.imageset/火车票机票.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/火车票机票.imageset/火车票机票.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/生活缴费.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "生活缴费.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/生活缴费.imageset/生活缴费.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/生活缴费.imageset/生活缴费.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/红包.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "红包.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/红包.imageset/红包.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/红包.imageset/红包.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/芝麻信用.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "芝麻信用.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/芝麻信用.imageset/芝麻信用.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/芝麻信用.imageset/芝麻信用.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/花呗.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "花呗.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/花呗.imageset/花呗.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/花呗.imageset/花呗.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/虚线框.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "虚线框.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/虚线框.imageset/虚线框.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/虚线框.imageset/虚线框.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/蚂上租租房.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "蚂上租租房.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/蚂上租租房.imageset/蚂上租租房.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/蚂上租租房.imageset/蚂上租租房.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/蚂蚁保险.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "蚂蚁保险.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/蚂蚁保险.imageset/蚂蚁保险.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/蚂蚁保险.imageset/蚂蚁保险.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/蚂蚁森林.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "蚂蚁森林.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/蚂蚁森林.imageset/蚂蚁森林.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/蚂蚁森林.imageset/蚂蚁森林.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/记账本.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "记账本.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/记账本.imageset/记账本.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/记账本.imageset/记账本.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/车主服务.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "车主服务.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/车主服务.imageset/车主服务.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/车主服务.imageset/车主服务.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/转账.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "转账.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/转账.imageset/转账.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/转账.imageset/转账.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/运动.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "运动.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/运动.imageset/运动.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/运动.imageset/运动.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/飞猪酒店.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "飞猪酒店.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/飞猪酒店.imageset/飞猪酒店.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/飞猪酒店.imageset/飞猪酒店.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/饿了么外卖.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "饿了么外卖.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/饿了么外卖.imageset/饿了么外卖.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/饿了么外卖.imageset/饿了么外卖.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/高德打车.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "高德打车.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Assets.xcassets/高德打车.imageset/高德打车.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiononhiii/LGFSwiftPT/01f10648854e0d674c3412bd7feb6dc4c012041f/LGFSwiftPTDemo/Assets.xcassets/高德打车.imageset/高德打车.png
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
96 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(MARKETING_VERSION)
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Tool/LGF+UIColor.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LGF+UIColor.swift
3 | // LGFFreePTDemo-swift
4 | //
5 | // Created by apple on 2019/7/26.
6 | // Copyright © 2019 来国锋. All rights reserved.
7 | //
8 |
9 | #if canImport(UIKit)
10 | import UIKit
11 |
12 | public extension UIColor {
13 |
14 | // MARK: - hex 16 进制颜色 传入(Int) 0x000000
15 | convenience init(lgf_Hex: Int, _ lgf_Alpha: Double = 1.0) {
16 | let r = CGFloat((lgf_Hex & 0xFF0000) >> 16) / 255.0
17 | let g = CGFloat((lgf_Hex & 0x00FF00) >> 8) / 255.0
18 | let b = CGFloat(lgf_Hex & 0x0000FF) / 255.0
19 | self.init(red: r, green: g, blue: b, alpha: CGFloat(lgf_Alpha))
20 | }
21 |
22 | // MARK: - hex 16 进制颜色 传入(String) "000000"
23 | convenience init?(lgf_HexString: String, _ lgf_Alpha: Double = 1.0) {
24 | let scanner = Scanner(string: lgf_HexString.replacingOccurrences(of: "#", with: ""))
25 | var rgbHex: UInt32 = 0
26 | guard scanner.scanHexInt32(&rgbHex) else {
27 | return nil
28 | }
29 | self.init(lgf_Hex: Int(rgbHex), lgf_Alpha)
30 | }
31 |
32 | // MARK: - rgb a
33 | @nonobjc
34 | convenience init(_ lgf_Red: Int, _ lgf_Green: Int, _ lgf_Blue: Int, _ lgf_Alpha: Double = 1.0) {
35 | self.init(red: CGFloat(lgf_Red) / 255, green: CGFloat(lgf_Green) / 255, blue: CGFloat(lgf_Blue) / 255, alpha: CGFloat(lgf_Alpha))
36 | }
37 |
38 | // MARK: - 随机颜色
39 | class func lgf_RandomColor() -> UIColor {
40 | return UIColor.init(Int(arc4random() % 256 / 255), Int(arc4random() % 256 / 255), Int(arc4random() % 256 / 255))
41 | }
42 |
43 | // MARK: - 随机灰度颜色
44 | class func lgf_RandomGrayColor() -> UIColor {
45 | let randomNumber = (Int(arc4random() % 200) + 55) / 255
46 | return UIColor.init(randomNumber, randomNumber, randomNumber)
47 | }
48 | }
49 |
50 | public extension UIColor {
51 | struct Components {
52 | var _base: UIColor
53 | public var rgba: (CGFloat, CGFloat, CGFloat, CGFloat) {
54 | var r: CGFloat = 0; var g: CGFloat = 0; var b: CGFloat = 0; var a: CGFloat = 0
55 | _base.getRed(&r, green: &g, blue: &b, alpha: &a)
56 | return (r, g, b, a)
57 | }
58 | public var hsv: (CGFloat, CGFloat, CGFloat) {
59 | var h: CGFloat = 0; var s: CGFloat = 0; var v: CGFloat = 0; var a: CGFloat = 0
60 | _base.getHue(&h, saturation: &s, brightness: &v, alpha: &a)
61 | return (h, s, v)
62 | }
63 | }
64 | var components: UIColor.Components {
65 | return Components(_base: self)
66 | }
67 | }
68 |
69 | #endif // canImport(UIKit)
70 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/Tool/LGF+UIDevice.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LGF+UIDevice.swift
3 | // LGFSwiftTool
4 | //
5 | // Created by apple on 2019/8/1.
6 | // Copyright © 2019 来国锋. All rights reserved.
7 | //
8 |
9 | #if canImport(UIKit)
10 | import UIKit
11 |
12 | public extension UIDevice {
13 |
14 | // MARK: - 屏幕宽度
15 | static let lgf_ScreenW = UIScreen.main.bounds.width
16 |
17 | // MARK: - 屏幕高度
18 | static let lgf_ScreenH = UIScreen.main.bounds.height
19 |
20 | // MARK: - 判断是否是 IphoneX 刘海机型
21 | class func lgf_IsIphoneX() -> Bool {
22 | if (lgf_ScreenW == 375 && lgf_ScreenH == 812) || (lgf_ScreenW == 812 && lgf_ScreenH == 375) {
23 | return true// MARK: - iphoneX/iphoneXS
24 | } else if (lgf_ScreenW == 414 && lgf_ScreenH == 896) || (lgf_ScreenW == 896 && lgf_ScreenH == 414) {
25 | return true// MARK: - iphoneXR/iphoneXSMax
26 | } else {
27 | return false
28 | }
29 | }
30 |
31 | // MARK: - 判断是否是 Iphone4
32 | class func lgf_IsIphone4() -> Bool {
33 | if (lgf_ScreenW == 640 || lgf_ScreenH == 960) && (lgf_ScreenW == 960 || lgf_ScreenH == 640) {
34 | return true// MARK: - iphone4
35 | } else {
36 | return false
37 | }
38 | }
39 |
40 | // MARK: - NavigationBar 高度
41 | class func lgf_NavBarH() -> CGFloat {
42 | return lgf_IsIphoneX() ? 88.0 : 64.0
43 | }
44 |
45 | // MARK: - TabBar 高度
46 | class func lgf_TabBarH() -> CGFloat {
47 | return lgf_IsIphoneX() ? 83.0 : 49.0
48 | }
49 |
50 | // MARK: - 顶部的安全距离
51 | class func lgf_TopSafeAreaH() -> CGFloat {
52 | return lgf_IsIphoneX() ? 20.0 : 0.0
53 | }
54 |
55 | // MARK: - 底部的安全距离
56 | class func lgf_BottomSafeAreaH() -> CGFloat {
57 | return lgf_IsIphoneX() ? 34.0 : 0.0
58 | }
59 |
60 | // MARK: - 375 自动 Cell 高度
61 | class func lgf_Iphone6Height(_ height: CGFloat) -> CGFloat {
62 | return (lgf_ScreenW / 375.0) * height
63 | }
64 |
65 | // MARK: - 电池栏小菊花
66 | static let lgf_NWA = UIApplication.shared.isNetworkActivityIndicatorVisible
67 |
68 | // MARK: - uuidString
69 | class func lgf_UUID() -> String? {
70 | return UIDevice.current.identifierForVendor?.uuidString
71 | }
72 |
73 | // MARK: - systemName
74 | class func lgf_SystemName() -> String {
75 | return UIDevice.current.systemName
76 | }
77 |
78 | // MARK: - systemVersion
79 | class func lgf_SystemVersion() -> String {
80 | return UIDevice.current.systemVersion
81 | }
82 |
83 | // MARK: - systemVersion(float)
84 | class func lgf_SystemFloatVersion() -> Float {
85 | return (lgf_SystemVersion() as NSString).floatValue
86 | }
87 |
88 | // MARK: - deviceName
89 | class func lgf_DeviceName() -> String {
90 | return UIDevice.current.name
91 | }
92 |
93 | // MARK: - device语言
94 | class func lgf_DeviceLanguage() -> String {
95 | return Bundle.main.preferredLocalizations[0]
96 | }
97 |
98 | // MARK: - 是否是iphone
99 | class func lgf_IsPhone() -> Bool {
100 | return UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone
101 | }
102 |
103 | // MARK: - 是否是ipad
104 | class func lgf_IsPad() -> Bool {
105 | return UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad
106 | }
107 |
108 | // MARK: - 屏幕旋转 是否需要动画
109 | static func lgf_SwitchNewOrientation(_ interfaceOrientation: UIInterfaceOrientation, animated: Bool) {
110 | if animated {
111 | self.lgf_SwitchNewOrientation(interfaceOrientation)
112 | } else {
113 | CATransaction.begin()
114 | CATransaction.setDisableActions(true)
115 | self.lgf_SwitchNewOrientation(interfaceOrientation)
116 | CATransaction.commit()
117 | }
118 | }
119 |
120 | // MARK: - 屏幕旋转
121 | static func lgf_SwitchNewOrientation(_ interfaceOrientation: UIInterfaceOrientation) {
122 | let resetOrientationTarget = NSNumber.init(value: Int8(UIInterfaceOrientation.unknown.rawValue))
123 | UIDevice.current.setValue(resetOrientationTarget, forKey: "orientation")
124 | let orientationTarget = NSNumber.init(value: Int8(interfaceOrientation.rawValue))
125 | UIDevice.current.setValue(orientationTarget, forKey: "orientation")
126 | }
127 |
128 | // MARK: - 清理缓存
129 | static func lgf_ClearCache() {
130 | // 取出cache文件夹目录 缓存文件都在这个目录下
131 | let cachePath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.cachesDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).first
132 | if cachePath == nil {
133 | return
134 | }
135 | // 取出文件夹下所有文件数组
136 | let fileArr = FileManager.default.subpaths(atPath: cachePath!)
137 | if fileArr == nil {
138 | return
139 | }
140 | // 遍历删除
141 | for file in fileArr! {
142 | let path = cachePath! + "/\(file)"
143 | if FileManager.default.fileExists(atPath: path) {
144 | do {
145 | try FileManager.default.removeItem(atPath: path)
146 | } catch {}
147 | }
148 | }
149 | }
150 |
151 | // MARK: - 获取缓存大小
152 | static func lgf_QueryCacheSize() -> String {
153 | let cachePath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first
154 | if cachePath == nil {
155 | return "0.0M"
156 | }
157 | let fileArr = FileManager.default.subpaths(atPath: cachePath!)
158 | if fileArr == nil {
159 | return "0.0M"
160 | }
161 | var size:CGFloat = 0.0
162 | for file in fileArr! {
163 |
164 | // 把文件名拼接到路径中
165 | let path = cachePath! + "/\(file)"
166 | // 取出文件属性
167 | if FileManager.default.fileExists(atPath: path) {
168 | do {
169 | let floder = try FileManager.default.attributesOfItem(atPath: path)
170 | // 用元组取出文件大小属性
171 | for (abc, bcd) in floder {
172 | // 累加文件大小
173 | if abc == FileAttributeKey.size {
174 | size += CGFloat(truncating: (bcd as AnyObject) as! NSNumber)
175 | }
176 | }
177 | } catch {
178 | debugPrint("文件路径为空!")
179 | }
180 | }
181 | }
182 | let cacheSize = size / 1024.0 / 1024.0
183 | return String.init(format: "%.1fM", cacheSize)
184 | }
185 | }
186 |
187 | #endif // canImport(UIKit)
188 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // LGFSwiftPTDemo
4 | //
5 | // Created by 来 on 2019/10/10.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController, LGFSwiftPTDelegate {
12 |
13 | @IBOutlet weak var showAliPayBtn: UIButton!
14 |
15 | func lgf_SelectSwiftPTTitle(_ selectIndex: Int) {
16 |
17 | }
18 |
19 | func lgf_RealSelectSwiftPTTitle(_ selectIndex: Int) {
20 | debugPrint(selectIndex)
21 | }
22 |
23 | var sview: UIView!
24 |
25 | var collectionView: UICollectionView!
26 |
27 | var swiftPT: LGFSwiftPT!
28 |
29 | override func viewWillAppear(_ animated: Bool) {
30 | super.viewWillAppear(animated)
31 | if #available(iOS 13.0, *) {
32 | UIApplication.shared.statusBarStyle = .lightContent
33 | } else {
34 |
35 | }
36 | }
37 |
38 | override func viewDidLoad() {
39 | super.viewDidLoad()
40 |
41 | let layout = UICollectionViewFlowLayout.init()
42 | layout.minimumLineSpacing = 0.0
43 | layout.minimumInteritemSpacing = 0.0
44 | layout.scrollDirection = .horizontal
45 | layout.sectionInset = UIEdgeInsets.init(top: 0, left: 0, bottom: 0, right: 0)
46 | collectionView = UICollectionView.init(frame: CGRect.init(x: 0, y: 190, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height - 70), collectionViewLayout: layout)
47 | collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "UICollectionViewCell")
48 | collectionView.delegate = self
49 | collectionView.dataSource = self
50 | collectionView.isPagingEnabled = true
51 | view.addSubview(self.collectionView)
52 |
53 | sview = UIView.init(frame: CGRect.init(x: 0, y: 150, width: 300, height: 40))
54 | view.addSubview(sview)
55 |
56 | creatSwiftPT()
57 |
58 | view.bringSubviewToFront(showAliPayBtn)
59 |
60 | }
61 |
62 | func creatSwiftPT() {
63 | let style = LGFSwiftPTStyle()
64 | style.lgf_IsShowLine = true
65 | style.lgf_LineHeight = 5
66 | style.lgf_LineWidth = 20
67 | style.lgf_LineAnimation = .tortoiseDown
68 | style.lgf_LineWidthType = .fixedWith
69 | style.lgf_StartDebug = true
70 | style.lgf_TitleTransformSX = 1.4
71 | style.lgf_PVAnimationType = .topToBottom
72 | style.lgf_TitleScrollFollowType = .leftRight
73 | style.lgf_TitleLeftRightSpace = 10
74 | style.lgf_IsHaveCenterLine = true
75 | style.lgf_CenterLineSize = CGSize.init(width: 1, height: 10)
76 | // 自定义特殊标
77 | let lab = UILabel.init()
78 | lab.lgfpt_SwiftPTSpecialTitleProperty = "4~~~120"// 4 添加到对应下标, 100 宽度
79 | lab.text = "我是特殊标"
80 | lab.textAlignment = .center
81 | lab.textColor = UIColor.white
82 | lab.font = UIFont.boldSystemFont(ofSize: 15)
83 | style.lgf_SwiftPTSpecialTitleArray = [lab]
84 |
85 | style.lgf_Titles = ["转入", "转出转闪电", "转入", "出", "", "转出", "转出", "转出", "转出", "转出", "转出", "转出", "转出"] // 这两句可以随意替换设置
86 |
87 | swiftPT = LGFSwiftPT.lgf(style, self, nil, nil)
88 | swiftPT.lgf_SwiftPTDelegate = self
89 | if swiftPT.lgf_SelectIndex == 0 {
90 |
91 | }
92 | sview.addSubview(swiftPT)
93 | swiftPT.lgf_ResetPageView(collectionView)
94 |
95 |
96 | // swiftPT.lgf_Style.lgf_Titles = ["转入", "转出转闪电", "转入", "出", "", "转出", "转出", "转出", "转出", "转出", "转出", "转出", "转出"]// 这两句可以随意替换设置
97 | swiftPT.lgf_ReloadTitle()// 这句必须设置,不然不刷新 swiftPT 的 UI,也可用来随时替换新的数据源(替换时如果你关联了外部 collectionview ,记得也同时修改你自己定义的外部 collectionview 的数据源防止数组越界)
98 | }
99 |
100 | @IBAction func testClick(_ sender: Any) {
101 |
102 | }
103 |
104 | @IBAction func showAliPay(_ sender: Any) {
105 | let vc = UIStoryboard.init(name: "VerticalViewController", bundle: Bundle.main).instantiateViewController(withIdentifier: "VerticalViewController")
106 | self.navigationController?.pushViewController(vc, animated: true)
107 | }
108 |
109 | // 特殊分割线可以用这个代理来实现
110 | func lgf_GetLGFSwiftPTCenterLine(_ centerLine: UIView, _ index: Int, _ style: LGFSwiftPTStyle, _ X: NSLayoutConstraint, _ Y: NSLayoutConstraint, _ W: NSLayoutConstraint, _ H: NSLayoutConstraint) {
111 | if index == 8 {
112 | centerLine.backgroundColor = UIColor.red
113 | W.constant = 10
114 | X.constant = -5
115 | }
116 | }
117 |
118 | func lgf_SetAllTitleState(_ allTitles: [LGFSwiftPTTitle], _ style: LGFSwiftPTStyle, _ selectTitle: LGFSwiftPTTitle, _ unSelectTitle: LGFSwiftPTTitle, _ selectIndex: Int, _ unSelectIndex: Int, _ progress: CGFloat) {
119 | unSelectTitle.lgf_SetMainTitleTransform(progress, false, selectIndex, unSelectIndex)
120 | selectTitle.lgf_SetMainTitleTransform(progress, true, selectIndex, unSelectIndex)
121 | }
122 |
123 | func lgf_GetLGFSwiftPTTitle(_ lgf_SwiftPTTitle: UIView, _ index: Int, _ style: LGFSwiftPTStyle) {
124 |
125 | }
126 | }
127 |
128 | extension ViewController: UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource {
129 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
130 | return collectionView.lgfpt_Size
131 | }
132 | func numberOfSections(in collectionView: UICollectionView) -> Int {
133 | return 1
134 | }
135 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
136 | return swiftPT.lgf_Style.lgf_Titles.count
137 | }
138 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
139 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "UICollectionViewCell", for: indexPath)
140 | cell.backgroundColor = UIColor.lgfpt_RandomColor()
141 | return cell
142 | }
143 | }
144 |
145 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/支付宝编辑页效果/VerticalViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // VerticalViewController.swift
3 | // LGFSwiftPTDemo
4 | //
5 | // Created by 来 on 2019/10/20.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class VerticalViewController: UIViewController {
12 |
13 | @IBOutlet weak var pageSuperView: UIView!
14 | @IBOutlet weak var pageSuperViewSuperView: UIView!
15 | @IBOutlet weak var headerView: UIView!
16 | @IBOutlet weak var collectionViewOne: UICollectionView!
17 | @IBOutlet weak var collectionViewOneBack: UIView!
18 | @IBOutlet weak var collectionViewFiveBack: UIView!
19 | @IBOutlet weak var latelyView: UIView!
20 | @IBOutlet weak var recommendView: UIView!
21 | @IBOutlet weak var collectionViewTwo: UICollectionView!
22 | @IBOutlet weak var collectionViewThree: UICollectionView!
23 | @IBOutlet weak var collectionViewFour: UICollectionView!
24 | @IBOutlet weak var collectionViewFive: UICollectionView!
25 | @IBOutlet weak var editButton: UIButton!
26 | @IBOutlet weak var completeButton: UIButton!
27 | // LGFSwiftPT
28 | lazy var fptView: LGFSwiftPT = {
29 | // 支付宝效果配置
30 | let style = LGFSwiftPTStyle()
31 | style.lgf_LineWidthType = .equalTitleSTR// 底部线对准字
32 | style.lgf_TitleLeftRightSpace = 10.0
33 | style.lgf_LineHeight = 2.0
34 | style.lgf_TitleSelectFont = UIFont.boldSystemFont(ofSize: 16)
35 | style.lgf_UnTitleSelectFont = UIFont.boldSystemFont(ofSize: 16)
36 | style.lgf_LineColor = UIColor.init(red: 15.0 / 255.0, green: 143.0 / 255.0, blue: 233.0 / 255.0, alpha: 1.0)
37 | style.lgf_TitleSelectColor = UIColor.init(red: 15.0 / 255.0, green: 143.0 / 255.0, blue: 233.0 / 255.0, alpha: 1.0)
38 | style.lgf_UnTitleSelectColor = UIColor.darkGray
39 | style.lgf_LineAnimation = .defult
40 | style.lgf_TitleScrollToTheMiddleAnimationDuration = 0.2
41 | let view = LGFSwiftPT.lgf(style, self, self.pageSuperView, nil)
42 | view.lgf_SwiftPTDelegate = self
43 | return view
44 | }()
45 | // 头部高度
46 | var headerHeight: CGFloat = 454.0 + 10.0
47 | // 我的应用数据源数组
48 | lazy var myDataArray: [String] = []
49 | // 最近使用数据源数组
50 | lazy var latelyDataArray: [String] = []
51 | // 底下数据源数组
52 | lazy var dataArray: [[String: [String]]] = []
53 | // 记录用于滚动选择判断的 contentOffset.y
54 | lazy var pageSelectYArray: [[Double]] = []
55 | // 是否编辑
56 | var isEdit: Bool = false
57 | var isSelectTitle: Bool = false
58 |
59 | override func viewWillAppear(_ animated: Bool) {
60 | super.viewWillAppear(animated)
61 | self.navigationController?.navigationBar.isHidden = true
62 | if #available(iOS 13.0, *) {
63 | UIApplication.shared.statusBarStyle = .lightContent
64 | } else {
65 |
66 | }
67 | }
68 |
69 | override func viewWillDisappear(_ animated: Bool) {
70 | super.viewWillDisappear(animated)
71 | self.navigationController?.navigationBar.isHidden = false
72 | }
73 |
74 | override func viewDidLoad() {
75 | super.viewDidLoad()
76 | if #available(iOS 11.0, *) {
77 | collectionViewOne.contentInsetAdjustmentBehavior = .never
78 | collectionViewTwo.contentInsetAdjustmentBehavior = .never
79 | collectionViewThree.contentInsetAdjustmentBehavior = .never
80 | collectionViewFour.contentInsetAdjustmentBehavior = .never
81 | collectionViewFive.contentInsetAdjustmentBehavior = .never
82 | } else {
83 | automaticallyAdjustsScrollViewInsets = false
84 | }
85 |
86 | myDataArray = ["转账", "信用卡还款", "淘票票电影", "花呗", "滴滴出行", "饿了么外卖", "蚂蚁庄园", "蚂蚁森林", "充值中心", "我的快递"]
87 | latelyDataArray = ["生活缴费", "城市服务", "车主服务", "红包", "商家服务", "发票管家", "借呗", "更多"]
88 | dataArray = [["便民生活" : ["充值中心", "信用卡还款", "生活缴费", "城市服务", "我的快递", "医疗健康", "记账本", "发票管家", "车主服务", "交通出行", "体育服务", "安全备忘"]],
89 | ["财富管理" : ["余额宝", "花呗", "芝麻信用", "借呗", "蚂蚁保险", "汇率换算"]],
90 | ["资金往来" : ["转账", "红包", "AA收款", "亲情号", "商家服务"]],
91 | ["购物娱乐" : ["出境", "彩票", "奖励金"]],
92 | ["教育公益" : ["校园生活", "蚂蚁森林", "蚂蚁庄园", "中小学", "运动", "亲子账户"]],
93 | ["第三方服务" : ["淘票票电影", "滴滴出行", "饿了么外卖", "天猫", "淘宝", "火车票机票", "飞猪酒店", "蚂上租租房", "高德打车", "哈啰出行"]]]
94 |
95 | // 计算需要选中的 contentOffset.y 保存
96 | var oldY = 0.0
97 | var newY = 0.0
98 | for (index, value) in dataArray.enumerated() {
99 | if let items = value.values.first {
100 | let num = ceilf(Float(items.count) / 4.0)
101 | newY = newY + (index == 0 ? 10.0 : 50.0) + Double(num) * 70.0
102 | pageSelectYArray.append([oldY, newY])
103 | oldY = oldY + (index == 0 ? 10.0 : 50.0) + Double(num) * 70.0
104 | }
105 | }
106 |
107 | // 刷新title数组[
108 | fptView.lgf_Style.lgf_Titles = ["便民生活", "财富管理", "资金往来", "购物娱乐", "教育公益", "第三方服务"]
109 | fptView.lgf_ReloadTitleAndSelectIndex(0, false, false)
110 | setHeader()
111 | }
112 |
113 | func setHeader() {
114 | // 设置头高度(可动态适配,我这边只用于示例代码因此是写死的高度)
115 | headerHeight = 454.0 + 10.0
116 | // 添加头
117 | headerView.frame = CGRect.init(x: 0.0, y: -headerHeight, width: UIScreen.main.bounds.width, height: headerHeight)
118 | collectionViewFour.addSubview(headerView)
119 | collectionViewFour.sendSubviewToBack(headerView)
120 | // 添加 LGFFreePTView 父控件
121 | pageSuperViewSuperView.frame = CGRect.init(x: 0.0, y: -10.0, width: UIScreen.main.bounds.width, height: 48.0)
122 | collectionViewFour.addSubview(pageSuperViewSuperView)
123 |
124 | setCVContentInset(0.0)
125 | }
126 |
127 | func setCVContentInset(_ top: CGFloat) {
128 | let f = (CGFloat(pageSelectYArray.last!.last! - pageSelectYArray.last!.first!) + top)
129 | let lastY = UIScreen.main.bounds.height - UIDevice.lgf_NavBarH() - 40.0 - f
130 | collectionViewFour.contentInset = UIEdgeInsets.init(top: headerHeight, left: 0.0, bottom: lastY, right: 0.0)
131 | collectionViewFour.setContentOffset(CGPoint.init(x: 0, y: 0.0 - collectionViewFour.contentInset.top), animated: false)
132 | }
133 |
134 | @IBAction func edit (_ sender: UIButton) {
135 | isEdit = !isEdit
136 | if isEdit {
137 | collectionViewFiveBack.frame = CGRect.init(x: 0.0, y: 0.0, width: UIDevice.lgf_ScreenW, height: 250.0)
138 | headerView.addSubview(collectionViewFiveBack)
139 | headerView.insertSubview(collectionViewFiveBack, belowSubview: latelyView)
140 | setCVContentInset(258.0)
141 | UIView.animate(withDuration: 0.3, animations: {
142 | self.collectionViewOneBack.transform = CGAffineTransform.init(translationX: 0.0, y: 20.0)
143 | self.latelyView.transform = CGAffineTransform.init(translationX: 0.0, y: self.collectionViewFive.lgfpt_Height)
144 | self.recommendView.transform = CGAffineTransform.init(translationX: 0.0, y: self.collectionViewFive.lgfpt_Height)
145 | self.collectionViewOneBack.alpha = 0.0
146 | self.recommendView.alpha = 0.0
147 | self.editButton.alpha = 0.0
148 | self.completeButton.alpha = 1.0
149 | self.collectionViewFive.transform = CGAffineTransform.init(translationX: 0.0, y: 10.0)
150 | self.collectionViewFiveBack.alpha = 1.0
151 | }) { (finish) in
152 | self.headerView.backgroundColor = UIColor.init(lgf_HexString: "F5F4FB")
153 | self.collectionViewFiveBack.removeFromSuperview()
154 | self.collectionViewFiveBack.frame = CGRect.init(x: 0.0, y: -self.headerHeight, width: UIDevice.lgf_ScreenW, height: 250.0)
155 | self.collectionViewFour.addSubview(self.collectionViewFiveBack)
156 | self.goEdit({
157 |
158 | })
159 | }
160 | } else {
161 | headerView.backgroundColor = UIColor.init(lgf_HexString: "FFFFFF")
162 | fptView.lgf_SelectIndex(0, 0.1, 0.25)
163 | setCVContentInset(0.0)
164 | goEdit {
165 | UIView.animate(withDuration: 0.3, animations: {
166 | self.collectionViewFive.transform = CGAffineTransform.identity
167 | self.collectionViewFiveBack.alpha = 0.0
168 | self.collectionViewOneBack.transform = CGAffineTransform.identity
169 | self.collectionViewOneBack.alpha = 1.0
170 | self.editButton.alpha = 1.0
171 | self.completeButton.alpha = 0.0
172 | }, completion: { (finish) in
173 | UIView.animate(withDuration: 0.3, animations: {
174 | self.latelyView.transform = CGAffineTransform.identity
175 | self.recommendView.transform = CGAffineTransform.identity
176 | self.recommendView.alpha = 1.0;
177 | }, completion: { (finish) in
178 | self.collectionViewFiveBack.removeFromSuperview()
179 | })
180 | })
181 | }
182 | }
183 | }
184 |
185 | func goEdit(_ completion: @escaping (() -> Void)) {
186 | UIView.animate(withDuration: 0.3, animations: {
187 | self.collectionViewTwo.visibleCells.forEach({ (view) in
188 | let cell = view as! VerticalViewControllerCell
189 | cell.isEdit = self.isEdit
190 | })
191 | self.collectionViewFour.visibleCells.forEach({ (view) in
192 | let cell = view as! VerticalViewControllerCell
193 | cell.isEdit = self.isEdit
194 | })
195 | }) { (finish) in
196 | completion()
197 | }
198 | }
199 |
200 | @IBAction func back(_ sender: Any) {
201 | self.navigationController?.popViewController(animated: true)
202 | }
203 | }
204 |
205 | extension VerticalViewController: UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource {
206 | func numberOfSections(in collectionView: UICollectionView) -> Int {
207 | if collectionView == collectionViewFour {
208 | return fptView.lgf_Style.lgf_Titles.count
209 | }
210 | return 1
211 | }
212 | func collectionView(_ collectionView: UICollectionView, willDisplaySupplementaryView view: UICollectionReusableView, forElementKind elementKind: String, at indexPath: IndexPath) {
213 | view.layer.zPosition = 0.0
214 | }
215 | func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
216 | if kind == UICollectionView.elementKindSectionHeader && collectionView == collectionViewFour {
217 | let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "VerticalViewControllerReusableView", for: indexPath) as! VerticalViewControllerReusableView
218 | header.title.text = fptView.lgf_Style.lgf_Titles[indexPath.section]
219 | if indexPath.section == 0 {
220 | header.lgfpt_Height = 0.0
221 | } else {
222 | header.lgfpt_Height = 40.0
223 | }
224 | return header
225 | }
226 | return UIView() as! UICollectionReusableView
227 | }
228 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
229 | if collectionView == collectionViewOne {
230 | return 6
231 | } else if collectionView == collectionViewTwo {
232 | return latelyDataArray.count
233 | } else if collectionView == collectionViewThree {
234 | return 10
235 | } else if collectionView == collectionViewFive {
236 | return myDataArray.count
237 | }
238 | let items: [String] = dataArray[section].values.first!
239 | return items.count
240 | }
241 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
242 | if collectionView == collectionViewOne {
243 | return CGSize.init(width: collectionView.lgfpt_Width / 6.0, height: collectionView.lgfpt_Height)
244 | } else if (collectionView == self.collectionViewTwo) {
245 | return CGSize.init(width: UIDevice.lgf_ScreenW / 4.0, height: 140.0 / 2.0)
246 | } else if (collectionView == self.collectionViewThree) {
247 | return CGSize.init(width: collectionView.lgfpt_Width / 3.1, height: collectionView.lgfpt_Height)
248 | } else if (collectionView == self.collectionViewFive) {
249 | return CGSize.init(width: UIDevice.lgf_ScreenW / 4.0, height: 140.0 / 2.0)
250 | }
251 | return CGSize.init(width: UIDevice.lgf_ScreenW / 4.0, height: 140.0 / 2.0)
252 | }
253 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
254 | if collectionView == collectionViewOne {
255 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VerticalViewControllerOneCell", for: indexPath) as! VerticalViewControllerOneCell
256 | cell.imageName = myDataArray[indexPath.item]
257 | return cell
258 | } else if collectionView == collectionViewTwo {
259 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VerticalViewControllerCell", for: indexPath) as! VerticalViewControllerCell
260 | cell.title.text = latelyDataArray[indexPath.item]
261 | cell.isEdit = isEdit
262 | cell.imageName = cell.title.text
263 | return cell
264 | } else if collectionView == collectionViewThree {
265 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VerticalViewControllerThreeCell", for: indexPath) as! VerticalViewControllerThreeCell
266 | return cell
267 | } else if collectionView == collectionViewFive {
268 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VerticalViewControllerCell", for: indexPath) as! VerticalViewControllerCell
269 | cell.title.text = myDataArray[indexPath.item]
270 | cell.imageName = cell.title.text
271 | return cell
272 | }
273 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VerticalViewControllerCell", for: indexPath) as! VerticalViewControllerCell
274 | cell.title.text = dataArray[indexPath.section].values.first?[indexPath.item]
275 | cell.isEdit = isEdit
276 | cell.imageName = cell.title.text
277 | return cell
278 | }
279 |
280 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
281 | if let cell = collectionView.cellForItem(at: indexPath) as? VerticalViewControllerCell {
282 | self.view.makeToast(cell.title.text)
283 | } else {
284 | self.view.makeToast("点击了 cell")
285 | }
286 | }
287 | }
288 |
289 | extension VerticalViewController: UIScrollViewDelegate {
290 | func scrollViewDidScroll(_ scrollView: UIScrollView) {
291 | if scrollView == collectionViewFour {
292 | pageSuperViewSuperView.lgfpt_Y = max(-18.0, isEdit ? (scrollView.contentOffset.y + 250.0) : (scrollView.contentOffset.y - 8.0))
293 | collectionViewFiveBack.lgfpt_Y = min(max(-headerHeight, scrollView.contentOffset.y), scrollView.contentOffset.y)
294 | if (!self.isSelectTitle) {
295 | for (index, value) in pageSelectYArray.enumerated() {
296 | let realY = isEdit ? (scrollView.contentOffset.y + 250.0 + 8.0) : scrollView.contentOffset.y
297 | if (realY > CGFloat(value.first!) && realY < CGFloat(value.last!)) {
298 | fptView.lgf_SelectIndex(index, 0.1, 0.25)
299 | }
300 | }
301 | }
302 | self.collectionViewFour.visibleCells.forEach({ (view) in
303 | let cell = view as! VerticalViewControllerCell
304 | if cell.isEdit != self.isEdit {
305 | cell.isEdit = self.isEdit
306 | }
307 | })
308 | }
309 | }
310 | }
311 |
312 | extension VerticalViewController: LGFSwiftPTDelegate {
313 | func lgf_SelectSwiftPTTitle(_ selectIndex: Int) {
314 | // 选中滚动
315 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(configIsSelectTitle), object: nil)
316 | isSelectTitle = true
317 | collectionViewFour.setContentOffset(CGPoint.init(x: 0.0, y: CGFloat(pageSelectYArray[selectIndex].first!) - (isEdit ? 250.0 + 8.0 : 0.0)), animated: true)
318 | perform(#selector(configIsSelectTitle), with: nil, afterDelay: 0.3)
319 | }
320 |
321 | @objc func configIsSelectTitle() {
322 | isSelectTitle = false
323 | }
324 | }
325 |
326 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/支付宝编辑页效果/View/VerticalViewControllerCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // VerticalViewControllerCell.swift
3 | // LGFSwiftPTDemo
4 | //
5 | // Created by 来 on 2019/10/20.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class VerticalViewControllerCell: UICollectionViewCell {
12 | @IBOutlet weak var editBack: UIView!
13 | @IBOutlet weak var deleteAndAdd: UIImageView!
14 | @IBOutlet weak var title: UILabel!
15 | @IBOutlet weak var image: UIImageView!
16 | var imageName: String! {
17 | didSet {
18 | self.image.image = UIImage.init(named: imageName)
19 | }
20 | }
21 | var isEdit: Bool! {
22 | didSet {
23 | if isEdit {
24 | self.editBack.alpha = 1.0
25 | self.deleteAndAdd.transform = CGAffineTransform.identity
26 | } else {
27 | self.editBack.alpha = 0.0
28 | self.deleteAndAdd.transform = CGAffineTransform.init(scaleX: 0.00001, y: 0.00001)
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/支付宝编辑页效果/View/VerticalViewControllerOneCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // VerticalViewControllerOneCell.swift
3 | // LGFSwiftPTDemo
4 | //
5 | // Created by 来 on 2019/10/20.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class VerticalViewControllerOneCell: UICollectionViewCell {
12 | @IBOutlet weak var image: UIImageView!
13 | var imageName: String! {
14 | didSet {
15 | self.image.image = UIImage.init(named: imageName)
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/支付宝编辑页效果/View/VerticalViewControllerReusableView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // VerticalViewControllerReusableView.swift
3 | // LGFSwiftPTDemo
4 | //
5 | // Created by 来 on 2019/10/20.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class VerticalViewControllerReusableView: UICollectionReusableView {
12 | @IBOutlet weak var title: UILabel!
13 | }
14 |
--------------------------------------------------------------------------------
/LGFSwiftPTDemo/支付宝编辑页效果/View/VerticalViewControllerThreeCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // VerticalViewControllerThreeCell.swift
3 | // LGFSwiftPTDemo
4 | //
5 | // Created by 来 on 2019/10/20.
6 | // Copyright © 2019 laiguofeng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class VerticalViewControllerThreeCell: UICollectionViewCell {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 来国锋
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## LGFSwiftPT (Swift4.2+)
2 | 可自由添加到指定位置的分页标控件
3 |
4 | ## 本代码为 LGFFreePT 的 Swift 版本,简化部分语法,原先OC版本的 style 配法不变,可使用 LGFFreePT(OC)版本的示例代码生成的 style
5 |
6 | ## Swift 版新增汽车之家挤压效果,新增自定义分割线
7 |
8 | ## 本代码已经通过 Instruments 检测
9 |
10 | ## 提示
11 | * 本示例代码仅支持 9.0+, 本控件可以支持到 8.0+
12 | * 本示例代码仅支持 swift4.2 +
13 |
14 | ## 制作目的
15 | * 想要把分页标放在视图任意位置
16 | * 把分页用的子控制器 Page 留给大家自己定义(传给 LGFSwiftPT 一个自己初始化的 UICollectionView,在自己的控制器里实现其代理,并在 cell 上添加子控制器就行)
17 |
18 | ## 部分效果展示
19 | * 毛毛虫底部线对准title
20 |
21 | 
22 |
23 | * 向下隐藏-底部线对准 title(自定义)
24 |
25 | 
26 |
27 | * 向上隐藏
28 |
29 | 
30 |
31 | * 普通底部线对准title
32 |
33 | 
34 |
35 | * 渐隐效果
36 |
37 | 
38 |
39 | * 模仿系统UISegment
40 |
41 | 
42 |
43 | * 指定index添加特殊title
44 |
45 | 
46 |
47 | * 主副title
48 |
49 | 
50 |
51 | * 主副title放大缩小
52 |
53 | 
54 |
55 | * 支付宝滚动更新title
56 |
57 | 
58 |
59 | * 淘宝首页
60 |
61 | 
62 |
63 |
64 | *这只是冰山一角,还有近千种效果等待你的组合发现,详件Demo ([LGFFreePT](https://github.com/aiononhiii/LGFFreePT))
65 |
66 | ## 功能
67 | * 实现了市面上大部分的效果,如果有新的需求请留言我
68 |
69 | ## 用法
70 | * 由于用法比较多,代码写的比较自由,有必要开到 h 文件的我全开到 h 文件了,有些效果也需要自己组合摸索,部分我未实现的效果我做了注释和报异常处理,如果组合中碰到崩溃有可能是我设置的异常,请查看异常Log.(具体还是下载我的示例代码,我的示例代码里列了一些我自己组合的效果,都是一些市面上主流的效果)
71 |
72 | ## 使用方式
73 | * pod 'LGFSwiftPT' 或者 [LGFSwiftPT](https://github.com/aiononhiii/LGFSwiftPT)
74 | 如果提示错误,请更新你的 cocoaPods ~>1.7.0
75 |
76 | ## 我的邮箱 - 452354033@qq.com
77 |
78 | ## 用了感觉不错的可以赠我一颗 github 星星,我将努力持续添加新的组合参数
79 | ## 有建议的也请在下方回复我,如果可行我会尽快采纳
80 |
--------------------------------------------------------------------------------