diff --git a/SwiftProject/Pods/Pods.xcodeproj/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist b/SwiftProject/Pods/Pods.xcodeproj/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..15ab346 --- /dev/null +++ b/SwiftProject/Pods/Pods.xcodeproj/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,294 @@ + + + + + SchemeUserState + + Alamofire.xcscheme_^#shared#^_ + + orderHint + 42 + + BoringSSL-GRPC-openssl_grpc.xcscheme_^#shared#^_ + + orderHint + 20 + + BoringSSL-GRPC.xcscheme_^#shared#^_ + + orderHint + 12 + + DeviceKit.xcscheme_^#shared#^_ + + orderHint + 11 + + FBSDKCoreKit.xcscheme_^#shared#^_ + + orderHint + 22 + + FacebookCore.xcscheme_^#shared#^_ + + orderHint + 10 + + Firebase.xcscheme_^#shared#^_ + + orderHint + 26 + + FirebaseAnalytics.xcscheme_^#shared#^_ + + orderHint + 49 + + FirebaseAppCheckInterop.xcscheme_^#shared#^_ + + orderHint + 38 + + FirebaseAuth-FirebaseAuth_Privacy.xcscheme_^#shared#^_ + + orderHint + 31 + + FirebaseAuth.xcscheme_^#shared#^_ + + orderHint + 43 + + FirebaseCore-FirebaseCore_Privacy.xcscheme_^#shared#^_ + + orderHint + 29 + + FirebaseCore.xcscheme_^#shared#^_ + + orderHint + 51 + + FirebaseCoreExtension-FirebaseCoreExtension_Privacy.xcscheme_^#shared#^_ + + orderHint + 50 + + FirebaseCoreExtension.xcscheme_^#shared#^_ + + orderHint + 5 + + FirebaseCoreInternal-FirebaseCoreInternal_Privacy.xcscheme_^#shared#^_ + + orderHint + 23 + + FirebaseCoreInternal.xcscheme_^#shared#^_ + + orderHint + 1 + + FirebaseCrashlytics-FirebaseCrashlytics_Privacy.xcscheme_^#shared#^_ + + orderHint + 41 + + FirebaseCrashlytics.xcscheme_^#shared#^_ + + orderHint + 35 + + FirebaseFirestore-FirebaseFirestore_Privacy.xcscheme_^#shared#^_ + + orderHint + 6 + + FirebaseFirestore.xcscheme_^#shared#^_ + + orderHint + 56 + + FirebaseFirestoreInternal-FirebaseFirestoreInternal_Privacy.xcscheme_^#shared#^_ + + orderHint + 54 + + FirebaseFirestoreInternal.xcscheme_^#shared#^_ + + orderHint + 32 + + FirebaseInstallations-FirebaseInstallations_Privacy.xcscheme_^#shared#^_ + + orderHint + 47 + + FirebaseInstallations.xcscheme_^#shared#^_ + + orderHint + 13 + + FirebaseRemoteConfigInterop.xcscheme_^#shared#^_ + + orderHint + 37 + + FirebaseSessions.xcscheme_^#shared#^_ + + orderHint + 36 + + FirebaseSharedSwift.xcscheme_^#shared#^_ + + orderHint + 39 + + GTMSessionFetcher-GTMSessionFetcher_Core_Privacy.xcscheme_^#shared#^_ + + orderHint + 7 + + GTMSessionFetcher.xcscheme_^#shared#^_ + + orderHint + 16 + + GoogleAppMeasurement.xcscheme_^#shared#^_ + + orderHint + 21 + + GoogleDataTransport-GoogleDataTransport_Privacy.xcscheme_^#shared#^_ + + orderHint + 17 + + GoogleDataTransport.xcscheme_^#shared#^_ + + orderHint + 24 + + GoogleUtilities-GoogleUtilities_Privacy.xcscheme_^#shared#^_ + + orderHint + 34 + + GoogleUtilities.xcscheme_^#shared#^_ + + orderHint + 15 + + Kingfisher-Kingfisher.xcscheme_^#shared#^_ + + orderHint + 57 + + Kingfisher.xcscheme_^#shared#^_ + + orderHint + 28 + + LLCycleScrollView.xcscheme_^#shared#^_ + + orderHint + 4 + + Pods-SwiftProject.xcscheme_^#shared#^_ + + orderHint + 45 + + PromisesObjC-FBLPromises_Privacy.xcscheme_^#shared#^_ + + orderHint + 30 + + PromisesObjC.xcscheme_^#shared#^_ + + orderHint + 33 + + PromisesSwift-Promises_Privacy.xcscheme_^#shared#^_ + + orderHint + 25 + + PromisesSwift.xcscheme_^#shared#^_ + + orderHint + 8 + + RecaptchaInterop.xcscheme_^#shared#^_ + + orderHint + 19 + + SVProgressHUD.xcscheme_^#shared#^_ + + orderHint + 46 + + SnapKit.xcscheme_^#shared#^_ + + orderHint + 52 + + TZImagePickerController.xcscheme_^#shared#^_ + + orderHint + 40 + + abseil.xcscheme_^#shared#^_ + + orderHint + 9 + + gRPC-C++-gRPCCertificates-Cpp.xcscheme_^#shared#^_ + + orderHint + 18 + + gRPC-C++-grpcpp.xcscheme_^#shared#^_ + + orderHint + 2 + + gRPC-C++.xcscheme_^#shared#^_ + + orderHint + 14 + + gRPC-Core-grpc.xcscheme_^#shared#^_ + + orderHint + 53 + + gRPC-Core.xcscheme_^#shared#^_ + + orderHint + 3 + + leveldb-library-leveldb_Privacy.xcscheme_^#shared#^_ + + orderHint + 27 + + leveldb-library.xcscheme_^#shared#^_ + + orderHint + 48 + + nanopb-nanopb_Privacy.xcscheme_^#shared#^_ + + orderHint + 44 + + nanopb.xcscheme_^#shared#^_ + + orderHint + 55 + + + + diff --git a/SwiftProject/SwiftProject.xcodeproj/project.pbxproj b/SwiftProject/SwiftProject.xcodeproj/project.pbxproj index 8bb8662..4a8f48e 100644 --- a/SwiftProject/SwiftProject.xcodeproj/project.pbxproj +++ b/SwiftProject/SwiftProject.xcodeproj/project.pbxproj @@ -106,9 +106,10 @@ AF2121092B4EA7E200400B7F /* CCRequestDefine.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF2121082B4EA7E200400B7F /* CCRequestDefine.swift */; }; AF21210B2B4EA7FE00400B7F /* CCRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF21210A2B4EA7FE00400B7F /* CCRequest.swift */; }; AF21210D2B4EA86700400B7F /* RootData.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF21210C2B4EA86700400B7F /* RootData.swift */; }; - AF478B032B577D51005C35A5 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF478B022B577D51005C35A5 /* AVFoundation.framework */; }; AFD9F5932B58C34A008716DE /* ImageProcessingShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = AFD9F5922B58C34A008716DE /* ImageProcessingShaders.metal */; }; AFD9F5952B58D029008716DE /* MetalPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFD9F5942B58D029008716DE /* MetalPlayer.swift */; }; + CBBE190C2BC929F50095F6C4 /* FeedBackVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBBE190B2BC929F50095F6C4 /* FeedBackVC.swift */; }; + CBC8BFBA2BC9082700FC49CC /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF478B022B577D51005C35A5 /* AVFoundation.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -220,6 +221,7 @@ AF478B022B577D51005C35A5 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; AFD9F5922B58C34A008716DE /* ImageProcessingShaders.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = ImageProcessingShaders.metal; sourceTree = ""; }; AFD9F5942B58D029008716DE /* MetalPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalPlayer.swift; sourceTree = ""; }; + CBBE190B2BC929F50095F6C4 /* FeedBackVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedBackVC.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -227,9 +229,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AF478B032B577D51005C35A5 /* AVFoundation.framework in Frameworks */, 00EB2D052BA2D59000924D84 /* MessageUI.framework in Frameworks */, 009DFB032BC63AF0007B56E8 /* CoreImage.framework in Frameworks */, + CBC8BFBA2BC9082700FC49CC /* AVFoundation.framework in Frameworks */, 1E277B76988DF1691E8E5A49 /* Pods_SwiftProject.framework in Frameworks */, 006B61D32BBAA938003FCB49 /* StoreKit.framework in Frameworks */, AF2120D42B4E99FA00400B7F /* MobileCoreServices.framework in Frameworks */, @@ -317,6 +319,7 @@ children = ( 009DFB102BC8E2E9007B56E8 /* MenuVC.swift */, 009DFB122BC8EA90007B56E8 /* MenuVCCell.swift */, + CBBE190B2BC929F50095F6C4 /* FeedBackVC.swift */, ); path = MenuVC; sourceTree = ""; @@ -812,6 +815,7 @@ 006B61DE2BBCFB45003FCB49 /* CustomSheetCell.swift in Sources */, 1EFB8C782B88E2F600C72119 /* UIColor+CCExtension.swift in Sources */, 00D33BF62B99A19900604A44 /* SpatialVideoConvertor.swift in Sources */, + CBBE190C2BC929F50095F6C4 /* FeedBackVC.swift in Sources */, AF2120EE2B4EA34E00400B7F /* BaseTableViewPlainController.swift in Sources */, 1E1EA28C2B93272700A5D5D2 /* CCSpatialDisplayTypeView.swift in Sources */, AF2120C62B4E95DA00400B7F /* UIView+Add.swift in Sources */, diff --git a/SwiftProject/SwiftProject.xcodeproj/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist b/SwiftProject/SwiftProject.xcodeproj/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..666ac8a --- /dev/null +++ b/SwiftProject/SwiftProject.xcodeproj/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + SwiftProject.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/zhou.xcuserdatad/UserInterfaceState.xcuserstate b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/zhou.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..2f3d628 Binary files /dev/null and b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/zhou.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..6c12aa5 --- /dev/null +++ b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/zhou.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,30 @@ + + + + + SchemeUserState + + Promises (Playground) 1.xcscheme + + isShown + + orderHint + 59 + + Promises (Playground) 2.xcscheme + + isShown + + orderHint + 60 + + Promises (Playground).xcscheme + + isShown + + orderHint + 58 + + + + diff --git a/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/Contents.json b/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/Contents.json new file mode 100644 index 0000000..5c114fc --- /dev/null +++ b/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "_@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "_@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/_@2x.png b/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/_@2x.png new file mode 100644 index 0000000..d24f6fc Binary files /dev/null and b/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/_@2x.png differ diff --git a/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/_@3x.png b/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/_@3x.png new file mode 100644 index 0000000..bec067f Binary files /dev/null and b/SwiftProject/SwiftProject/Assets.xcassets/ProblemSuggestion description'logo.imageset/_@3x.png differ diff --git a/SwiftProject/SwiftProject/Project/Controller/MenuVC/FeedBackVC.swift b/SwiftProject/SwiftProject/Project/Controller/MenuVC/FeedBackVC.swift new file mode 100644 index 0000000..561f3d5 --- /dev/null +++ b/SwiftProject/SwiftProject/Project/Controller/MenuVC/FeedBackVC.swift @@ -0,0 +1,233 @@ +// +// FeedBackVC.swift +// SwiftProject +// +// Created by Mr.Zhou on 2024/4/12. +// + +import UIKit + +class FeedBackVC: BaseController, UITextViewDelegate, UITextFieldDelegate { + //问题意见标题Label + private lazy var problemTitleLabel:UILabel = setLabel(NSLocalizedString("v1.5_problem/suggestion title", comment: ""), color: .init(r: 255, g: 255, b: 255, a: 0.8), font: .systemFont(ofSize: 16, weight: .medium)) + //问题意见文本框 + private lazy var problemTextView:UITextView = { + let textView:UITextView = .init() + textView.textColor = .white + textView.font = .systemFont(ofSize: 14, weight: .medium) + textView.text = "" + textView.backgroundColor = .clear + textView.delegate = self + return textView + }() + //问题意见占位字符 + private lazy var problemPlaceholderLabel:UILabel = setLabel(NSLocalizedString("v1.5_problem/suggestion placeholder", comment: ""), color: .init(r: 255, g: 255, b: 255, a: 0.6), font: .systemFont(ofSize: 14, weight: .medium)) + //1号计数Label + private lazy var oneNumbersLabel:UILabel = setLabel("0/500", color: .init(r: 255, g: 255, b: 255, a: 0.5), font: .systemFont(ofSize: 14, weight: .medium)) + //问联系信息标题Label + private lazy var contactTitleLabel:UILabel = setLabel(NSLocalizedString("v1.5_contact information title", comment: ""), color: .init(r: 255, g: 255, b: 255, a: 0.8), font: .systemFont(ofSize: 16, weight: .medium)) + + //联系信息输入框 + private lazy var contactTextField:UITextField = { + let textField:UITextField = .init() + textField.text = "" + textField.textColor = .white + textField.font = .systemFont(ofSize: 14, weight: .medium) + textField.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("v1.5_contact information placeholder", comment: ""), attributes: [.foregroundColor:UIColor(r: 255, g: 255, b: 255, a: 0.6), .font:UIFont.systemFont(ofSize: 14, weight: .medium)]) + textField.borderStyle = .none + textField.delegate = self + return textField + }() + //二号计数Label + private lazy var twoNumbersLabel:UILabel = setLabel("0/30", color: .init(r: 255, g: 255, b: 255, a: 0.5), font: .systemFont(ofSize: 14, weight: .medium)) + //提交按钮 + private lazy var submitButton:UIButton = { + let btn = UIButton() + btn.setTitle(NSLocalizedString("v1.5_submit", comment: ""), for: .normal) + btn.setTitle(NSLocalizedString("v1.5_submit", comment: ""), for: .disabled) + btn.setTitleColor(.init(r: 255, g: 255, b: 255, a: 0.6), for: .disabled) + btn.setTitleColor(.white, for: .normal) + btn.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) + btn.addTarget(self, action: #selector(submitClick(_ :)), for: .touchUpInside) + //不可选中颜色 + btn.backgroundColor = .init(r: 42, g: 42, b: 42, a: 1) + btn.layer.masksToBounds = true + btn.layer.cornerRadius = 12 + + return btn + }() + override func viewDidLoad() { + super.viewDidLoad() + navLine?.isHidden = true + setLeftOneBtnImg(imgStr: "menuvc_backbtn") + leftBtn1?.addTarget(self, action: #selector(popVC(_ :)), for: .touchUpInside) + self.view.backgroundColor = UIColor(r: 6, g: 5, b: 7, a: 1) + //设置标题 + titleLab?.isHidden = false + setNavgaionTitle(string: NSLocalizedString("v1.5_feedback", comment: "")) + setNavgationTitleAttribute(font: .systemFont(ofSize: 18, weight: .medium), color: .white) + configureUI() + } + + //生成label + private func setLabel(_ text:String, color:UIColor, font:UIFont) -> UILabel { + let label = UILabel() + label.text = text + label.textColor = color + label.font = font + label.numberOfLines = 0 + return label + } + //配置UI + private func configureUI() { + //配置问题/意见View + let problemView = problemView() + view.addSubview(problemView) + problemView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.top.equalToSuperview().offset(145) + make.width.equalTo(345) + make.height.equalTo(120) + } + view.addSubview(problemTitleLabel) + problemTitleLabel.snp.makeConstraints { make in + make.left.equalTo(problemView.snp.left).offset(12) + make.bottom.equalTo(problemView.snp.top).offset(-12) + } + let imageView = UIImageView(image: .init(named: "ProblemSuggestion description'logo")) + view.addSubview(imageView) + imageView.snp.makeConstraints { make in + make.top.equalTo(problemTitleLabel) + make.left.equalTo(problemTitleLabel.snp.right) + } + //配置联系我们View + let contactView = contactView() + view.addSubview(contactView) + contactView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.top.equalTo(problemView.snp.bottom).offset(72) + make.width.equalTo(345) + make.height.equalTo(56) + } + view.addSubview(contactTitleLabel) + contactTitleLabel.snp.makeConstraints { make in + make.left.equalTo(problemTitleLabel) + make.bottom.equalTo(contactView.snp.top).offset(-10) + } + //添加提交按钮 + view.addSubview(submitButton) + submitButton.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.bottom.equalToSuperview().offset(-52) + make.width.equalTo(345) + make.height.equalTo(54) + } + } + //生成问题意见View + private func problemView() -> UIView { + let bgView = UIView() + bgView.backgroundColor = .init(r: 29, g: 29, b: 29, a: 1) + bgView.layer.masksToBounds = true + bgView.layer.cornerRadius = 12 + bgView.addSubview(problemTextView) + problemTextView.snp.makeConstraints { make in + make.top.left.equalToSuperview().offset(12) + make.right.equalToSuperview().offset(-12) + make.height.equalTo(72) + } + bgView.addSubview(problemPlaceholderLabel) + problemTitleLabel.snp.makeConstraints { make in + make.top.left.right.equalTo(problemTextView) + } + bgView.addSubview(oneNumbersLabel) + oneNumbersLabel.snp.makeConstraints { make in + make.right.bottom.equalToSuperview().offset(-12) + } + return bgView + } + //生成联系我们View + private func contactView() -> UIView { + let bgView = UIView() + bgView.backgroundColor = .init(r: 29, g: 29, b: 29, a: 1) + bgView.layer.masksToBounds = true + bgView.layer.cornerRadius = 8 + bgView.addSubview(twoNumbersLabel) + twoNumbersLabel.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.right.equalToSuperview().offset(-12) + } + bgView.addSubview(contactTextField) + contactTextField.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.left.equalToSuperview().offset(12) + make.right.equalToSuperview().offset(-42) + } + return bgView + } + //MARK: - textField And textView + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { + let text = (textField.text! as NSString).replacingCharacters(in: range, with: string) + guard text.count <= 30 else { + twoNumbersLabel.text = "30/30" + return false + } + twoNumbersLabel.text = "\(text.count)/30" + return true + } + func textViewShouldBeginEditing(_ textView: UITextView) -> Bool { + self.problemPlaceholderLabel.isHidden = true // 隐藏 + return true + } + func textViewDidBeginEditing(_ textView: UITextView) { + + } + func textViewShouldEndEditing(_ textView: UITextView) -> Bool { + return true + } + func textViewDidEndEditing(_ textView: UITextView) { + if textView.text.isEmpty { + self.problemPlaceholderLabel.isHidden = false // 显示 + } + else{ + self.problemPlaceholderLabel.isHidden = true // 隐藏 + } + } + func textViewDidChange(_ textView: UITextView) { + + } + //获取textView字符内容 + func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + let str = (textView.text! as NSString).replacingCharacters(in: range, with: text) + guard text.count <= 500 else { + oneNumbersLabel.text = "500/500" + submitButton.isEnabled = true + submitButton.backgroundColor = .init(r: 83, g: 38, b: 214, a: 1) + return false + } + if text.count >= 5 { + submitButton.isEnabled = true + submitButton.backgroundColor = .init(r: 83, g: 38, b: 214, a: 1) + }else { + submitButton.isEnabled = false + submitButton.backgroundColor = .init(r: 42, g: 42, b: 42, a: 1) + } + oneNumbersLabel.text = "\(text.count)/500" + return true + } + //pop回上一个控制器 + @objc private func popVC(_ sender:UIButton) { + navigationController?.popViewController(animated: true) + } + //提交 + @objc private func submitClick(_ sender:UIButton) { + //获取 + let probleText = problemTextView.text + let contact = contactTextField.text + //获取设备唯一标识 + + //上传用户反馈的内容 + + //pop退出页面 + navigationController?.popViewController(animated: true) + } +} diff --git a/SwiftProject/SwiftProject/Project/Controller/MenuVC/MenuVC.swift b/SwiftProject/SwiftProject/Project/Controller/MenuVC/MenuVC.swift index b46b200..325f6c1 100644 --- a/SwiftProject/SwiftProject/Project/Controller/MenuVC/MenuVC.swift +++ b/SwiftProject/SwiftProject/Project/Controller/MenuVC/MenuVC.swift @@ -11,18 +11,13 @@ import Firebase class MenuVC: BaseController,UITableViewDelegate,UITableViewDataSource { static let kMenuVCCell_identifier = "kMenuVCCell_identifier" - var dataSource:[[[String:String]]] { + var dataSource:[[[String:Any]]]{ get { - return [[["image":"icon","title":NSLocalizedString("Share VPCamera", comment: "")], - ["image":"icon","title":NSLocalizedString("Feedback", comment: "")]], - [["image":"icon","title":NSLocalizedString("Privacy Policy", comment: "")], - ["image":"icon","title":NSLocalizedString("Terms of Service", comment: "")]], - [["image":"icon","title":NSLocalizedString("WeChat", comment: "")], - ["image":"icon","title":NSLocalizedString("Tencent QQ", comment: "")], - ["image":"icon","title":NSLocalizedString("Telegram", comment: "")], - ["image":"icon","title":NSLocalizedString("Share VPCamera", comment: "")]]] + [getDatasourceOneSection(), getDatasourceTwoSection(), getDatasourceThreeSection()] } } + + override func viewDidLoad() { super.viewDidLoad() self.configureUI() @@ -62,9 +57,10 @@ class MenuVC: BaseController,UITableViewDelegate,UITableViewDataSource { make.left.right.equalToSuperview() make.height.equalTo(162) } - + //创建一个底部View(内置一个tableView) let bottomView = buttomView() self.view.addSubview(bottomView) + //覆盖主视图下半部分 bottomView.snp.makeConstraints { make in make.left.right.equalToSuperview() make.bottom.equalToSuperview().offset(-20) @@ -109,47 +105,141 @@ class MenuVC: BaseController,UITableViewDelegate,UITableViewDataSource { func buttomView() -> UIView { let bgView = UIView() + //创建tableView let tableView = UITableView(frame: .zero, style: .insetGrouped) + //注册cell tableView.register(MenuVCCell.classForCoder(), forCellReuseIdentifier: MenuVC.kMenuVCCell_identifier) + //将tableView添加入bgView bgView.addSubview(tableView) + //tableView全覆盖 tableView.snp.makeConstraints { make in - make.left.top.bottom.right.equalToSuperview() + make.top.bottom.equalToSuperview() + make.left.equalToSuperview().offset(24) + make.right.equalToSuperview().offset(-24) } - tableView.backgroundColor = .red + //实现tableView数据源和代理 + tableView.dataSource = self + tableView.delegate = self + //颜色为透明 + tableView.backgroundColor = .clear return bgView } @objc func dismissVC(sender:UIButton) { self.dismiss(animated: true) } - - - - //MARK: - TableViewDelegate and DataSource - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 0 + //数据源第一组(Share VPCamera And Feedback),key值为image、title + private func getDatasourceOneSection () -> [[String:Any]] { + return [ + ["image":UIImage(named: "")!, "title":NSLocalizedString("v1.5_share vpcamera", comment: "")], + ["image":UIImage(named: "")!, "title":NSLocalizedString("v1.5_feedback", comment: "")] + ] + } + //数据源第二组(Privacy Policy And Terms of Service),key值为image、title + private func getDatasourceTwoSection () -> [[String:Any]] { + return [ + ["image":UIImage(named: "")!, "title":NSLocalizedString("v1.5_privacy policy", comment: "")], + ["image":UIImage(named: "")!, "title":NSLocalizedString("v1.5_terms of service", comment: "")] + ] + } + //数据源第三组,网络获取,key值为 image、title、url + private func getDatasourceThreeSection () -> [[String:Any]] { + let url = URL(string: "XXXXXX") + + return [ + ["image":UIImage(named: ""), "title":"title", "url":"url"] + ] } + //MARK: - TableViewDelegate and DataSource func numberOfSections(in tableView: UITableView) -> Int { - return 3 + return dataSource.count + } + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return dataSource[section].count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: MenuVC.kMenuVCCell_identifier, for: indexPath) + let cell = tableView.dequeueReusableCell(withIdentifier: MenuVC.kMenuVCCell_identifier, for: indexPath) as! MenuVCCell + cell.data = dataSource[indexPath.section][indexPath.row] + if dataSource[indexPath.section].count == 1 { + //这一组只有一行 + cell.radiusType = .all + }else { + switch indexPath.row { + case 0: + cell.radiusType = .top + case dataSource[indexPath.section].count - 1: + cell.radiusType = .bottom + default: + cell.radiusType = ._none + } + } return cell } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - 55 - } - - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - + return 52 } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - return UIView() + let sectionView:UIView = .init(frame: .init(x: 0, y: 0, width: tableView.bounds.width, height: 54)) + sectionView.backgroundColor = .clear + //添加一个Label + let titleLabel = UILabel() + titleLabel.textColor = .init(r: 255, g: 255, b: 255, a: 0.5) + titleLabel.text = section == 2 ? NSLocalizedString("v1.5_contact us", comment: ""):"" + titleLabel.font = .systemFont(ofSize: 15, weight: .medium) + sectionView.addSubview(titleLabel) + titleLabel.snp.makeConstraints { make in + make.bottom.equalToSuperview().offset(-10) + make.left.equalToSuperview() + } + titleLabel.isHidden = !(section == 2) + return sectionView + } + func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { + switch section { + case 0: + return 0 + case dataSource[section].count - 1: + return 54 + default: + return 18 + } + } + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + switch indexPath.section { + case 0://第一组 + switch indexPath.row { + case 0://Share VPCamera,执行分享 + //设置分享文本 + let text = "VPCamera" + //分享图片icon + let image = UIImage(named: "AppIcon") + //设置分享路径 + let url = URL(string: "") + let activityItems = [text,image as Any,url as Any] + //弹出分享框 + let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities:nil) + present(activityViewController, animated: true, completion: nil) + //分享结束后的回调 + activityViewController.completionWithItemsHandler = { [weak self] ( activityType, isCompleted, returnedItems, error) -> Void in + print(isCompleted ? "Share Success":"Share Failure") + } + default://反馈 + let feedVC = FeedBackVC() + navigationController?.pushViewController(feedVC, animated: true) + } + case 1://第二组 + switch indexPath.row { + case 0://Privacy Policy,执行隐私政策 + break + default://Terms of Service, 执行服务条例 + break + } + default://跳转组 + break + } } - - } diff --git a/SwiftProject/SwiftProject/Project/Controller/MenuVC/MenuVCCell.swift b/SwiftProject/SwiftProject/Project/Controller/MenuVC/MenuVCCell.swift index 5898301..1f36206 100644 --- a/SwiftProject/SwiftProject/Project/Controller/MenuVC/MenuVCCell.swift +++ b/SwiftProject/SwiftProject/Project/Controller/MenuVC/MenuVCCell.swift @@ -8,29 +8,91 @@ import Foundation import UIKit class MenuVCCell: UITableViewCell { - var limgView:UIImageView? - var ltitleLabel:UILabel? + //cell圆角类型 + enum MenuVCCellCornerRadiusType:Int { + ///没有圆角 + case _none = 0 + ///上圆角 + case top = 1 + ///下圆角 + case bottom = 2 + ///全部圆角 + case all = 3 + ///对应切除范围 + var maskcorners:CACornerMask { + switch self { + case ._none: + return [] + case .top: + return [.layerMinXMinYCorner, .layerMaxXMinYCorner] + case .bottom: + return [.layerMinXMaxYCorner, .layerMaxXMaxYCorner] + case .all: + return [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner] + } + } + ///对应圆角度数 + var corner:CGFloat{ + switch self { + case ._none: + return 0 + default: + return 12 + } + } + } + //当前cell的圆角 + var radiusType:MenuVCCellCornerRadiusType! { + didSet{ + layer.maskedCorners = radiusType.maskcorners + layer.cornerRadius = radiusType.corner + } + } + //展示内容 + var data:[String:Any]!{ + didSet{ + //获取图片 + iconImageView.image = data["image"] as? UIImage + //设置标题 + titleLabel.text = data["title"] as? String + } + } + + //icon展示 + fileprivate lazy var iconImageView:UIImageView = { + let imageView:UIImageView = .init() + imageView.contentMode = .scaleAspectFill + return imageView + }() + //标题Label + fileprivate lazy var titleLabel:UILabel = { + let label = UILabel() + label.textColor = .white + label.font = .systemFont(ofSize: 14, weight: .medium) + label.text = "Text" + return label + }() override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) - self.backgroundColor = UIColor(r: 29, g: 29, b: 29, a: 1) - limgView = UIImageView() - self.contentView.addSubview(limgView!) - ltitleLabel = UILabel() - self.contentView.addSubview(ltitleLabel!) - - limgView?.snp.makeConstraints({ make in - make.width.height.equalTo(20) + backgroundColor = UIColor(r: 29, g: 29, b: 29, a: 1) + selectionStyle = .none + //设置icon + addSubview(iconImageView) + iconImageView.snp.makeConstraints { make in + make.left.equalTo(16) make.centerY.equalToSuperview() - make.left.equalToSuperview().offset(16) - }) - - ltitleLabel?.snp.makeConstraints {[weak self] make in - make.centerY.equalToSuperview() - make.left.equalTo((self?.limgView!.snp.right)!).offset(12) + make.width.height.equalTo(16) } + //设置标题Label + addSubview(titleLabel) + titleLabel.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.left.equalTo(12) + make.right.equalToSuperview().offset(-16) + } + //设置超出范围切除 + layer.masksToBounds = true - ltitleLabel!.textColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1) - ltitleLabel!.font = UIFont(name: "PingFangSC-Medium", size: 14) } required init?(coder: NSCoder) { diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayForVideoTask.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayForVideoTask.swift index b934c53..8b20b6d 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayForVideoTask.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayForVideoTask.swift @@ -139,7 +139,6 @@ extension CCSpatialVideoDisplayController { assetReader?.cancelReading() } assetReader = try! AVAssetReader(asset: self.videoOriginalAsset) - assetOutput = AVAssetReaderTrackOutput( track: self.assetTrack!, outputSettings: [ diff --git a/SwiftProject/SwiftProject/en.lproj/Localizable.strings b/SwiftProject/SwiftProject/en.lproj/Localizable.strings index f9ba9fb..e1b90f0 100644 --- a/SwiftProject/SwiftProject/en.lproj/Localizable.strings +++ b/SwiftProject/SwiftProject/en.lproj/Localizable.strings @@ -121,3 +121,14 @@ "v1.5_praise" = "Praise"; "v1.5_negative" = "Negative"; "v1.5_feedbackdesc" = "Do you like VPCamera?\nPlease rate a Five star or give a feed\n back to us"; +//V1.5版本,用于功能集合页 +"v1.5_share vpcamera" = "Share VPCamera" +"v1.5_feedback" = "Feedback" +"v1.5_privacy policy" = "Privacy Policy" +"v1.5_terms of service" = "Terms of Service" +"v1.5_contact us" = "Contact us" +"v1.5_problem/suggestion placeholder" = "Please let us kno'w your prablems or suggestions. Our service team will deal with it soon." +"v1.5_problem/suggestion title" = "Problem/Suggestion description" +"v1.5_contact information placeholder" = "Please @xxxx.com" +"v1.5_contact information title" = "Contact information" +"v1.5_submit" = "Submit" diff --git a/SwiftProject/SwiftProject/zh-Hans.lproj/Localizable.strings b/SwiftProject/SwiftProject/zh-Hans.lproj/Localizable.strings index 1a1e054..91648a1 100644 --- a/SwiftProject/SwiftProject/zh-Hans.lproj/Localizable.strings +++ b/SwiftProject/SwiftProject/zh-Hans.lproj/Localizable.strings @@ -117,7 +117,14 @@ "右侧中间键长按3s" = "右侧中间键长按3s"; "右侧亮度循环按键" ="右侧亮度循环按键\n长按 3s 切换 HSBS\n长按 7s 切换 FSBS"; - - - - +//V1.5版本,用于功能集合页 +"v1.5_share vpcamera" = "分享 VPCamera" +"v1.5_feedback" = "反馈意见" +"v1.5_privacy policy" = "隐私政策" +"v1.5_terms of service" = "服务条款" +"v1.5_contact us" = "联系我们" +"v1.5_problem/suggestion title" = "问题/建议描述" +"v1.5_problem/suggestion placeholder" = "请告知我们您的问题或建议。我们的服务团队将尽快处理。" +"v1.5_contact information title" = "联系信息" +"v1.5_contact information placeholder" = "请输入 @xxxx.com" +"v1.5_submit" = "提交"