tabbar开发
12
Podfile
@ -1,7 +1,17 @@
|
|||||||
# Uncomment the next line to define a global platform for your project
|
# Uncomment the next line to define a global platform for your project
|
||||||
source 'https://github.com/CocoaPods/Specs.git'
|
#source 'https://github.com/CocoaPods/Specs.git'
|
||||||
platform :ios, '15.6'
|
platform :ios, '15.6'
|
||||||
|
|
||||||
|
post_install do |installer|
|
||||||
|
installer.pods_project.targets.each do |target|
|
||||||
|
target.build_configurations.each do |config|
|
||||||
|
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
||||||
|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
|
||||||
|
config.build_settings['EXCLUDED_ARCHITECTURES'] = 'i386'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
target 'Veloria' do
|
target 'Veloria' do
|
||||||
|
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
|
10
Podfile.lock
@ -11,7 +11,9 @@ PODS:
|
|||||||
- Moya/Core (= 15.0.0)
|
- Moya/Core (= 15.0.0)
|
||||||
- Moya/Core (15.0.0):
|
- Moya/Core (15.0.0):
|
||||||
- Alamofire (~> 5.0)
|
- Alamofire (~> 5.0)
|
||||||
- SmartCodable (4.3.9)
|
- SmartCodable (5.0.9):
|
||||||
|
- SmartCodable/Core (= 5.0.9)
|
||||||
|
- SmartCodable/Core (5.0.9)
|
||||||
- SnapKit (5.7.1)
|
- SnapKit (5.7.1)
|
||||||
- Toast (4.1.1)
|
- Toast (4.1.1)
|
||||||
- YYKit (1.0.9):
|
- YYKit (1.0.9):
|
||||||
@ -35,7 +37,7 @@ DEPENDENCIES:
|
|||||||
- ZFPlayer/AVPlayer
|
- ZFPlayer/AVPlayer
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
https://github.com/CocoaPods/Specs.git:
|
trunk:
|
||||||
- Alamofire
|
- Alamofire
|
||||||
- CocoaAsyncSocket
|
- CocoaAsyncSocket
|
||||||
- ESTabBarController-swift
|
- ESTabBarController-swift
|
||||||
@ -59,12 +61,12 @@ SPEC CHECKSUMS:
|
|||||||
KTVHTTPCache: 5711692cdf9a5ecfe829b1e16577deb3ffe3dc86
|
KTVHTTPCache: 5711692cdf9a5ecfe829b1e16577deb3ffe3dc86
|
||||||
MJRefresh: ff9e531227924c84ce459338414550a05d2aea78
|
MJRefresh: ff9e531227924c84ce459338414550a05d2aea78
|
||||||
Moya: 138f0573e53411fb3dc17016add0b748dfbd78ee
|
Moya: 138f0573e53411fb3dc17016add0b748dfbd78ee
|
||||||
SmartCodable: efc682e18fb5eac77f4c0497e37c79590710c192
|
SmartCodable: 68b3598438181a938eed8ee5623e58ef3e3ea443
|
||||||
SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
|
SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
|
||||||
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
|
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
|
||||||
YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7
|
YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7
|
||||||
ZFPlayer: 5cf39e8d9f0c2394a014b0db4767b5b5a6bffe13
|
ZFPlayer: 5cf39e8d9f0c2394a014b0db4767b5b5a6bffe13
|
||||||
|
|
||||||
PODFILE CHECKSUM: d4ff89d9ef2517ec087add019c6f39f8e9ee69d0
|
PODFILE CHECKSUM: 41b6b69056545708f3956ded0b47fda298f175b8
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
|
@ -492,7 +492,7 @@
|
|||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = TWDZ3MP9DV;
|
DEVELOPMENT_TEAM = "";
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = Veloria/Source/Info.plist;
|
INFOPLIST_FILE = Veloria/Source/Info.plist;
|
||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
@ -527,7 +527,7 @@
|
|||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = TWDZ3MP9DV;
|
DEVELOPMENT_TEAM = "";
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = Veloria/Source/Info.plist;
|
INFOPLIST_FILE = Veloria/Source/Info.plist;
|
||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// AppDelegate.swift
|
// AppDelegate.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// SceneDelegate.swift
|
// SceneDelegate.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPNavigationController.swift
|
// VPNavigationController.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPTabBarController.swift
|
// VPTabBarController.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
@ -10,6 +10,41 @@ import ESTabBarController_swift
|
|||||||
|
|
||||||
class VPTabBarController: UITabBarController {
|
class VPTabBarController: UITabBarController {
|
||||||
|
|
||||||
|
private var ignoreNextSelection = false
|
||||||
|
|
||||||
|
override var selectedViewController: UIViewController? {
|
||||||
|
willSet {
|
||||||
|
guard let newValue = newValue else {
|
||||||
|
// if newValue == nil ...
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
guard !ignoreNextSelection else {
|
||||||
|
ignoreNextSelection = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let tabBar = self.tabBar as? VPTabBar, let index = viewControllers?.firstIndex(of: newValue) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tabBar.select(itemAtIndex: index, animated: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override var selectedIndex: Int {
|
||||||
|
willSet {
|
||||||
|
guard let tabBar = self.tabBar as? VPTabBar else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guard !ignoreNextSelection else {
|
||||||
|
ignoreNextSelection = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
tabBar.select(itemAtIndex: newValue, animated: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
let tabBar = VPTabBar()
|
let tabBar = VPTabBar()
|
||||||
@ -48,10 +83,10 @@ extension VPTabBarController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
let nav1 = createNavigationController(viewController: VPHomePageViewController(), title: "Home".localized, image: UIImage(named: ""), selectedImage: UIImage(named: ""))
|
let nav1 = createNavigationController(viewController: VPHomePageViewController(), title: "Home".localized, image: UIImage(named: "tabbar_icon_01"), selectedImage: UIImage(named: "tabbar_icon_01_selected"))
|
||||||
let nav2 = createNavigationController(viewController: VPHomePageViewController(), title: "Home".localized, image: UIImage(named: ""), selectedImage: UIImage(named: ""))
|
let nav2 = createNavigationController(viewController: VPHomePageViewController(), title: "Home".localized, image: UIImage(named: "tabbar_icon_02"), selectedImage: UIImage(named: "tabbar_icon_02_selected"))
|
||||||
let nav3 = createNavigationController(viewController: VPHomePageViewController(), title: "Home".localized, image: UIImage(named: ""), selectedImage: UIImage(named: ""))
|
let nav3 = createNavigationController(viewController: VPHomePageViewController(), title: "Home".localized, image: UIImage(named: "tabbar_icon_03"), selectedImage: UIImage(named: "tabbar_icon_03_selected"))
|
||||||
let nav4 = createNavigationController(viewController: VPHomePageViewController(), title: "Home".localized, image: UIImage(named: ""), selectedImage: UIImage(named: ""))
|
let nav4 = createNavigationController(viewController: VPHomePageViewController(), title: "Home".localized, image: UIImage(named: "tabbar_icon_03"), selectedImage: UIImage(named: "tabbar_icon_04_selected"))
|
||||||
|
|
||||||
viewControllers = [nav1, nav2, nav3, nav4]
|
viewControllers = [nav1, nav2, nav3, nav4]
|
||||||
|
|
||||||
@ -68,6 +103,9 @@ extension VPTabBarController {
|
|||||||
// tabBarItem.contentView?.titleLabel.font = .fontRegular(ofSize: 13)
|
// tabBarItem.contentView?.titleLabel.font = .fontRegular(ofSize: 13)
|
||||||
|
|
||||||
let tabBarItem = VPTabBarItem()
|
let tabBarItem = VPTabBarItem()
|
||||||
|
tabBarItem.title = title
|
||||||
|
tabBarItem.image = image
|
||||||
|
tabBarItem.selectedImage = selectedImage
|
||||||
|
|
||||||
let nav = VPNavigationController(rootViewController: viewController)
|
let nav = VPNavigationController(rootViewController: viewController)
|
||||||
// nav.tabBarItem.title = title
|
// nav.tabBarItem.title = title
|
||||||
@ -89,7 +127,7 @@ extension VPTabBarController {
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
if let vc = viewControllers?[idx] {
|
if let vc = viewControllers?[idx] {
|
||||||
// ignoreNextSelection = true
|
ignoreNextSelection = true
|
||||||
selectedIndex = idx
|
selectedIndex = idx
|
||||||
delegate?.tabBarController?(self, didSelect: vc)
|
delegate?.tabBarController?(self, didSelect: vc)
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPViewController.swift
|
// VPViewController.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPDefine.swift
|
// VPDefine.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// UIColor+VPAdd.swift
|
// UIColor+VPAdd.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// UIDevice+VPAdd.swift
|
// UIDevice+VPAdd.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// UIFont+VPAdd.swift
|
// UIFont+VPAdd.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// UIScreen+VPAdd.swift
|
// UIScreen+VPAdd.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// UIView+VPAdd.swift
|
// UIView+VPAdd.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPModel.swift
|
// VPModel.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPCryptorService.swift
|
// VPCryptorService.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPTabBar.swift
|
// VPTabBar.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPTabBarItem.swift
|
// VPTabBarItem.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
@ -12,6 +12,23 @@ class VPTabBarItem: UITabBarItem {
|
|||||||
private(set) var contentView: VPTabBarItemContentView
|
private(set) var contentView: VPTabBarItemContentView
|
||||||
|
|
||||||
|
|
||||||
|
override var title: String? {
|
||||||
|
didSet {
|
||||||
|
contentView.title = title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
override var image: UIImage? {
|
||||||
|
didSet {
|
||||||
|
contentView.image = image
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override var selectedImage: UIImage? {
|
||||||
|
didSet {
|
||||||
|
contentView.selectedImage = selectedImage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public init(_ contentView: VPTabBarItemContentView = VPTabBarItemContentView(), title: String? = nil, image: UIImage? = nil, selectedImage: UIImage? = nil, tag: Int = 0) {
|
public init(_ contentView: VPTabBarItemContentView = VPTabBarItemContentView(), title: String? = nil, image: UIImage? = nil, selectedImage: UIImage? = nil, tag: Int = 0) {
|
||||||
self.contentView = contentView
|
self.contentView = contentView
|
||||||
super.init()
|
super.init()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPTabBarItemContainer.swift
|
// VPTabBarItemContainer.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
@ -38,7 +38,7 @@ class VPTabBarItemContainer: UIControl {
|
|||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
if let contentView = contentView {
|
if let contentView = contentView {
|
||||||
contentView.frame = self.bounds
|
contentView.frame = self.bounds
|
||||||
contentView.updateLayout()
|
// contentView.updateLayout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPTabBarItemContentView.swift
|
// VPTabBarItemContentView.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
@ -19,22 +19,37 @@ class VPTabBarItemContentView: UIView {
|
|||||||
/// 是否支持高亮
|
/// 是否支持高亮
|
||||||
open var highlightEnabled = true
|
open var highlightEnabled = true
|
||||||
|
|
||||||
|
var title: String? {
|
||||||
|
didSet {
|
||||||
|
selectedView.title = title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var image: UIImage? {
|
||||||
|
didSet {
|
||||||
|
normalView.image = image
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectedImage: UIImage? {
|
||||||
|
didSet {
|
||||||
|
selectedView.image = selectedImage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private lazy var normalView: VPTabBarItemNormalVew = {
|
private lazy var normalView: VPTabBarItemNormalVew = {
|
||||||
let view = VPTabBarItemNormalVew()
|
let view = VPTabBarItemNormalVew()
|
||||||
view.isHidden = false
|
view.alpha = 1
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private lazy var selectedView: VPTabBarItemSelectedView = {
|
private lazy var selectedView: VPTabBarItemSelectedView = {
|
||||||
let view = VPTabBarItemSelectedView()
|
let view = VPTabBarItemSelectedView()
|
||||||
view.isHidden = true
|
view.alpha = 0
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
backgroundColor = .yellow
|
|
||||||
self.isUserInteractionEnabled = false
|
self.isUserInteractionEnabled = false
|
||||||
self.layer.masksToBounds = true
|
self.layer.masksToBounds = true
|
||||||
|
|
||||||
@ -66,8 +81,8 @@ class VPTabBarItemContentView: UIView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateLayout() {
|
func updateLayout() {
|
||||||
normalView.isHidden = selected
|
// normalView.isHidden = selected
|
||||||
selectedView.isHidden = !selected
|
// selectedView.isHidden = !selected
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,28 +153,41 @@ extension VPTabBarItemContentView {
|
|||||||
|
|
||||||
// MARK: - ANIMATION METHODS
|
// MARK: - ANIMATION METHODS
|
||||||
func selectAnimation(animated: Bool, completion: (() -> ())?) {
|
func selectAnimation(animated: Bool, completion: (() -> ())?) {
|
||||||
self.selectedView.isHidden = false
|
if animated {
|
||||||
self.normalView.isHidden = true
|
UIView.animate(withDuration: VPTabBar.animateDuration) { [weak self] in
|
||||||
|
guard let self = self else { return }
|
||||||
|
self.selectedView.alpha = 1
|
||||||
|
self.normalView.alpha = 0
|
||||||
|
} completion: { finis in
|
||||||
|
completion?()
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
self.selectedView.alpha = 1
|
||||||
|
self.normalView.alpha = 0
|
||||||
|
completion?()
|
||||||
|
}
|
||||||
|
|
||||||
// UIView.animate(withDuration: VPTabBar.animateDuration) {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// } completion: { finish in
|
|
||||||
// <#code#>
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
completion?()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func deselectAnimation(animated: Bool, completion: (() -> ())?) {
|
func deselectAnimation(animated: Bool, completion: (() -> ())?) {
|
||||||
self.selectedView.isHidden = true
|
|
||||||
self.normalView.isHidden = false
|
if animated {
|
||||||
completion?()
|
UIView.animate(withDuration: VPTabBar.animateDuration) { [weak self] in
|
||||||
|
guard let self = self else { return }
|
||||||
|
self.selectedView.alpha = 0
|
||||||
|
self.normalView.alpha = 1
|
||||||
|
} completion: { finis in
|
||||||
|
completion?()
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
self.selectedView.alpha = 0
|
||||||
|
self.normalView.alpha = 1
|
||||||
|
completion?()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func reselectAnimation(animated: Bool, completion: (() -> ())?) {
|
func reselectAnimation(animated: Bool, completion: (() -> ())?) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPTabBarItemNormalVew.swift
|
// VPTabBarItemNormalVew.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,14 +2,26 @@
|
|||||||
// VPTabBarItemSelectedView.swift
|
// VPTabBarItemSelectedView.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class VPTabBarItemSelectedView: VPGradientView {
|
class VPTabBarItemSelectedView: VPGradientView {
|
||||||
|
|
||||||
private lazy var contentView: UIView = {
|
var image: UIImage? {
|
||||||
|
didSet {
|
||||||
|
iconImageView.image = image
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var title: String? {
|
||||||
|
didSet {
|
||||||
|
titleLabel.text = title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private lazy var bgView: UIView = {
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
view.backgroundColor = .color353537()
|
view.backgroundColor = .color353537()
|
||||||
view.layer.cornerRadius = VPTabBar.itemMinWidth / 2 - 3
|
view.layer.cornerRadius = VPTabBar.itemMinWidth / 2 - 3
|
||||||
@ -17,6 +29,23 @@ class VPTabBarItemSelectedView: VPGradientView {
|
|||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
private lazy var contentView: UIView = {
|
||||||
|
let view = UIView()
|
||||||
|
return view
|
||||||
|
}()
|
||||||
|
|
||||||
|
private lazy var iconImageView: UIImageView = {
|
||||||
|
let imageView = UIImageView()
|
||||||
|
return imageView
|
||||||
|
}()
|
||||||
|
|
||||||
|
private lazy var titleLabel: UILabel = {
|
||||||
|
let label = UILabel()
|
||||||
|
label.font = .fontRegular(ofSize: 13)
|
||||||
|
label.textColor = .colorFFFFFF()
|
||||||
|
return label
|
||||||
|
}()
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
colors = [UIColor.color7C174F().cgColor, UIColor.color05CEA0().cgColor]
|
colors = [UIColor.color7C174F().cgColor, UIColor.color05CEA0().cgColor]
|
||||||
@ -41,14 +70,33 @@ class VPTabBarItemSelectedView: VPGradientView {
|
|||||||
extension VPTabBarItemSelectedView {
|
extension VPTabBarItemSelectedView {
|
||||||
|
|
||||||
private func vp_setupUI() {
|
private func vp_setupUI() {
|
||||||
addSubview(contentView)
|
addSubview(bgView)
|
||||||
|
bgView.addSubview(contentView)
|
||||||
|
contentView.addSubview(iconImageView)
|
||||||
|
contentView.addSubview(titleLabel)
|
||||||
|
|
||||||
contentView.snp.makeConstraints { make in
|
bgView.snp.makeConstraints { make in
|
||||||
make.left.equalToSuperview().offset(3)
|
make.left.equalToSuperview().offset(3)
|
||||||
make.top.equalToSuperview().offset(3)
|
make.top.equalToSuperview().offset(3)
|
||||||
make.center.equalToSuperview()
|
make.center.equalToSuperview()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contentView.snp.makeConstraints { make in
|
||||||
|
make.top.bottom.equalToSuperview()
|
||||||
|
make.centerX.equalToSuperview()
|
||||||
|
}
|
||||||
|
|
||||||
|
iconImageView.snp.makeConstraints { make in
|
||||||
|
make.centerY.equalToSuperview()
|
||||||
|
make.left.equalToSuperview()
|
||||||
|
}
|
||||||
|
|
||||||
|
titleLabel.snp.makeConstraints { make in
|
||||||
|
make.centerY.equalToSuperview()
|
||||||
|
make.left.equalTo(iconImageView.snp.right).offset(8)
|
||||||
|
make.right.equalToSuperview()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPGradientView.swift
|
// VPGradientView.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPHomePageViewController.swift
|
// VPHomePageViewController.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPAppTool.swift
|
// VPAppTool.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// VPLocalizedManager.swift
|
// VPLocalizedManager.swift
|
||||||
// Veloria
|
// Veloria
|
||||||
//
|
//
|
||||||
// Created by 佳尔 on 2025/5/19.
|
// Created by Veloria on 2025/5/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
6
Veloria/Source/Assets.xcassets/icon/Contents.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
6
Veloria/Source/Assets.xcassets/tabbar/Contents.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
22
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_01.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_01.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 915 B |
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_01.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.2 KiB |
22
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_01_selected.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_01_selected.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 487 B |
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_01_selected.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 651 B |
22
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_02.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_02.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 800 B |
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_02.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
22
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_02_selected.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_02_selected.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 449 B |
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_02_selected.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 654 B |
22
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_03.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_03.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 691 B |
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_03.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 945 B |
22
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_03_selected.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_03_selected.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 382 B |
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_03_selected.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 476 B |
22
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_04.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_04.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 1016 B |
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_04.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.4 KiB |
22
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_04_selected.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_04_selected.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 516 B |
BIN
Veloria/Source/Assets.xcassets/tabbar/tabbar_icon_04_selected.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 714 B |
@ -2,7 +2,7 @@
|
|||||||
Localizable.strings
|
Localizable.strings
|
||||||
VideoPlayer
|
VideoPlayer
|
||||||
|
|
||||||
Created by 佳尔 on 2025/5/19.
|
Created by Veloria on 2025/5/19.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|