Commit 378d92de authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '1634f9a9' into xiezhaolin

parents 6877e63c 1634f9a9
This diff is collapsed.
......@@ -138,35 +138,13 @@ extension AppDelegate {
v3.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "我的", image: UIImage(named: "me"), selectedImage: UIImage(named: "me_1"))
tabBarController.viewControllers = [v0,v1,v2,v3]
// tabBarController.viewControllers = [v1,v2] //for test hjl 配合测试同学做自动化测试 Moon 2023.03.12
tabBarController.tabBar.backgroundColor = .white
window = UIWindow(frame: UIScreen.main.bounds)
// window?.rootViewController = tabBarController
window?.rootViewController = YHStartPageViewController()
window?.makeKeyAndVisible()
}
// private func requestData() {
// self.homeReqVM.getHomeConfig { flag, error in
// if flag == true {
// //1. 调用model 刷新界面
// YHHUD.flash(message: "数据已更新")
// } else {
// //2. 给出 错误提示
// if let error = error {
// YHHUD.flash(message: error.errorMsg)
// }
// }
// }
// }
}
......@@ -104,7 +104,7 @@ class YHMessageSessionCell: UITableViewCell {
make.left.equalTo(iconContentView.snp.right).offset(16)
make.right.equalTo(timeLabel.snp.left).offset(-20)
make.top.equalTo(iconContentView)
make.height.equalTo(20)
make.height.equalTo(21)
}
detailLabel.snp.makeConstraints { make in
......
......@@ -38,20 +38,14 @@ extension YHTabBarViewController {
//展示tabbar上的横线
func handleTabBarLine() -> Void {
let rect = CGRect.init(x:0,y:0,width:KScreenWidth,height:0.5)
let fillColor = UIColor(hex:0x888888)
let fillColor = UIColor(hex:0x222222,transparency: 0.2)!
let img = UIImage.from(color: fillColor, rect: rect)
UIView.transition(with:self.tabBar, duration:0.5, options: .transitionCrossDissolve) {
if #available(iOS 13.0, *) {
let appearance = self.tabBar.standardAppearance.copy()
appearance.backgroundImage = UIImage()
appearance.shadowImage = img
self.tabBar.standardAppearance = appearance
}
else{
self.tabBar.backgroundImage = UIImage()
self.tabBar.shadowImage = img
}
let appearance = self.tabBar.standardAppearance.copy()
appearance.backgroundImage = UIImage()
appearance.shadowImage = img
self.tabBar.standardAppearance = appearance
} completion: { Bool in
}
}
......
//
// YHDavidTestViewController.swift
// galaxy
//
// Created by davidhuangA on 2024/1/10.
// Copyright © 2024 www.davidhuang.com. All rights reserved.
//
import UIKit
import ESPullToRefresh
import JXSegmentedView
import GKNavigationBarSwift
class YHDavidTestViewController: YHBaseViewController {
var vcCanScroll : Bool = true
lazy var descripeLable:UILabel = {
let label = UILabel()
label.text = "赴港攻略,当日往返无忧,这个季节风景..赴港攻略,当日往返无忧,这个季节风景"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
label.numberOfLines = 2
label.lineBreakMode = .byTruncatingTail
return label
}()
lazy var headImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "home_person_icon"))
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var nameLable:UILabel = {
let label = UILabel()
label.text = "Fiona"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
return label
}()
lazy var dateLable:UILabel = {
let label = UILabel()
label.text = "12-12"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
return label
}()
lazy var heartImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "home_red_heart"))
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var numLable:UILabel = {
let label = UILabel()
label.text = "2000"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 14)
return label
}()
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
}()
private lazy var bannerView: YHHomeBannerView = {
let view = YHHomeBannerView()
return view
}()
lazy var myCollectView = {
// 设置布局方向
let flowLayout = UICollectionViewFlowLayout()
let margin = 20.0
let gap = 20.0
let itemWidth = ceil((KScreenWidth - 2*margin - gap)/2.0)
flowLayout.itemSize = CGSize(width: itemWidth, height: 210 + 87 + 4)
flowLayout.minimumInteritemSpacing = 10.0
flowLayout.minimumLineSpacing = 10.0
flowLayout.scrollDirection = .vertical
let collectinoView = YHGestureCollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectinoView.contentInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
collectinoView.backgroundColor = .white
collectinoView.register(YHAboutUsAdvantageCell.self, forCellWithReuseIdentifier:YHAboutUsAdvantageCell.cellReuseIdentifier)
collectinoView.register(YHDavidTestCollectionViewCell.self, forCellWithReuseIdentifier:YHDavidTestCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true
return collectinoView
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
view.backgroundColor = .white
gk_navigationBar.isHidden = true
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
self.myCollectView.reloadData()
}
}
extension YHDavidTestViewController {
private func loadFirstItem() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
self.myCollectView.es.stopPullToRefresh(ignoreDate: true,ignoreFooter: false)
self.myCollectView.reloadData()
}
}
private func loadFakeData() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.myCollectView.es.stopLoadingMore()
self.myCollectView.reloadData()
}
}
func setupUI() {
gk_navTitle = "David的测试UI"
view.backgroundColor = .white
view.addSubview(myCollectView)
myCollectView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalToSuperview().offset(10)
}
self.myCollectView.es.addInfiniteScrolling {
self.loadFakeData()
}
}
}
extension YHDavidTestViewController: UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHDavidTestCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHDavidTestCollectionViewCell
return cell
}
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("index is \(indexPath.row)")
}
}
// MARK: - JXSegmentedListContainerViewListDelegate
extension YHDavidTestViewController: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
// MARK: - 滑动使用
extension YHDavidTestViewController: UIScrollViewDelegate {
//控制滑动交互
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let scrollViewSet: CGFloat = scrollView.contentOffset.y
if vcCanScroll == false {//不能滚动时
scrollView.contentOffset = CGPoint(x: -20, y: 0)
} else {
if (scrollViewSet <= 0) {
scrollView.contentOffset = CGPoint(x: -20, y: 0)
vcCanScroll = false
NotificationCenter.default.post(name: Notification.Name(rawValue: "leaveTop"), object: nil)
} else {
scrollView.contentOffset = CGPoint(x: -20, y: scrollViewSet)
}
}
}
}
......@@ -16,10 +16,6 @@ class YHHomePageViewController: YHBaseViewController {
return viewModel
}()
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
}()
lazy var homeCollectView = {
// 设置布局方向
let flowLayout = YHHomeCollectionLayout()
......@@ -32,7 +28,6 @@ class YHHomePageViewController: YHBaseViewController {
collectinoView.register(YHHomeCollectionViewCell.self, forCellWithReuseIdentifier:YHHomeCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
// collectinoView.bounces = false
collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true
return collectinoView
......
//
// ContentBaseViewController.swift
// JXSegmentedView
//
// Created by jiaxin on 2018/12/26.
// Copyright © 2018 jiaxin. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHMainContentBaseViewController: UIViewController {
var canScroll : Bool = false {
didSet {
for vc in arrItemVCs {
vc.vcCanScroll = canScroll
}
}
}
let arrItemTitles = ["推荐","子女教育","税务规划","民生医疗","成功案例","我的服务","行业资讯","香港生活","你我他","我是很长的tag呀"]
var arrItemVCs : [YHDavidTestViewController] = []
var segmentedView : JXSegmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 40))
lazy var segmentedDataSource: JXSegmentedBaseDataSource = {
let dataSource = JXSegmentedTitleDataSource()
dataSource.isTitleColorGradientEnabled = true
dataSource.titles = arrItemTitles
dataSource.titleNormalFont = UIFont.PFSC_M(ofSize: 16)
dataSource.titleNormalColor = .labelTextColor2
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 18)
dataSource.titleSelectedColor = .brandMainColor
dataSource.isItemSpacingAverageEnabled = false
dataSource.itemWidth = JXSegmentedViewAutomaticDimension
dataSource.itemSpacing = 24
return dataSource
}()
//分类title 所对应的VC
lazy var listContainerView: JXSegmentedListContainerView! = {
return JXSegmentedListContainerView(dataSource: self, type: .collectionView)
}()
override func viewDidLoad() {
super.viewDidLoad()
for _ in arrItemTitles {
let vc = YHDavidTestViewController()
arrItemVCs.append(vc)
}
//segmentedViewDataSource一定要通过属性强持有!!!!!!!!!
segmentedView.dataSource = segmentedDataSource
segmentedView.delegate = self
view.addSubview(segmentedView)
segmentedView.listContainer = listContainerView
view.addSubview(listContainerView)
//分类Title
segmentedView.dataSource = segmentedDataSource
segmentedView.delegate = self
//配置指示器
let indicator = JXSegmentedIndicatorLineView()
indicator.indicatorWidth = 16
indicator.indicatorColor = .blue
segmentedView.indicators = [indicator]
segmentedView.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//处于第一个item的时候,才允许屏幕边缘手势返回
navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
//离开页面的时候,需要恢复屏幕边缘手势,不能影响其他页面
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
segmentedView.frame = CGRect(x: 0, y: 0, width: view.bounds.size.width, height: 50)
listContainerView.frame = CGRect(x: 0, y: 50, width: view.bounds.size.width, height: view.bounds.size.height - 50)
}
}
extension YHMainContentBaseViewController: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
NotificationCenter.default.post(name: Notification.Name(rawValue: "scrollViewDidEndDragging"), object: nil)
}
/// 正在滚动中的回调
///
/// - Parameters:
/// - segmentedView: JXSegmentedView
/// - leftIndex: 正在滚动中,相对位置处于左边的index
/// - rightIndex: 正在滚动中,相对位置处于右边的index
/// - percent: 从左往右计算的百分比
func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
NotificationCenter.default.post(name: Notification.Name(rawValue: "scrollViewWillBeginDragging"), object: nil)
}
}
extension YHMainContentBaseViewController: JXSegmentedListContainerViewDataSource {
func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
return titleDataSource.dataSource.count
}
return 0
}
func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
return arrItemVCs[index]
}
}
......@@ -22,6 +22,9 @@ class YHHomeListModel: YHBaseModel {
var img_url: String = ""
var type: Int = 0 //文章类型 '文章类型 1视频 2图文 3图片',
var is_like : Bool = false
var media_url : String = ""
//网络返回的图片宽高
var img_width: CGFloat = 0
......
//
// YHBbxCollectionViewCell.swift
// galaxy
//
// Created by davidhuangA on 2024/1/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHBbxCollectionViewCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHBbxCollectionViewCell"
static let bbxCellHeight = 64
static let bbxCellWidth = 80
lazy var titleImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "home_bbx_icon"))
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var descripeLable:UILabel = {
let label = UILabel()
label.textColor = UIColor(red: 0.315, green: 0.315, blue: 0.315, alpha: 1)
label.font = UIFont.PFSC_R(ofSize: 12)
label.textAlignment = .center
label.text = "证件办理"
// label.backgroundColor = .blue
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
private func setupUI() {
contentView.addSubview(titleImageView)
titleImageView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.height.width.equalTo(44)
make.centerX.equalToSuperview()
}
contentView.addSubview(descripeLable)
descripeLable.snp.makeConstraints { make in
make.top.equalTo(titleImageView.snp.bottom).offset(4)
make.centerX.equalToSuperview()
make.height.equalTo(16)
make.left.right.equalToSuperview()
}
}
}
//
// YHDavidCell0.swift
// galaxy
//
// Created by davidhuangA on 2024/1/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHDavidCell0: UITableViewCell {
static let cellReuseIdentifier = "YHDavidCell0"
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
setupUI()
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
lazy var headImage: UIImageView = {
let imagV = UIImageView()
imagV.contentMode = .scaleAspectFill
imagV.image = UIImage(named: "home_cell0_head_icon")
return imagV
}()
lazy var contentImage: UIImageView = {
let imagV = UIImageView()
imagV.contentMode = .scaleAspectFill
imagV.image = UIImage(named: "home_cell0_content_icon")
return imagV
}()
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
contentView.addSubview(headImage)
contentView.addSubview(contentImage)
contentImage.snp.makeConstraints { make in
make.top.equalToSuperview().offset(12)
make.right.equalToSuperview().offset(-16)
make.width.equalTo(242)
make.height.equalTo(97)
}
headImage.snp.makeConstraints { make in
make.right.equalTo(contentImage.snp.left)
make.width.equalTo(88)
make.height.equalTo(122)
make.bottom.equalToSuperview()
}
}
}
//
// YHDavidCell0.swift
// galaxy
//
// Created by davidhuangA on 2024/1/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHDavidCell1: UITableViewCell {
static let cellReuseIdentifier = "YHDavidCell1"
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
setupUI()
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
lazy var bigImageView: UIImageView = {
let imagV = UIImageView()
imagV.contentMode = .scaleToFill
imagV.image = UIImage(named: "home_cell1_bkg")
return imagV
}()
lazy var subContentView : UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0x999999, alpha: 1.0)
view.layer.cornerRadius = kCornerRadius6
return view
}()
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
contentView.addSubview(subContentView)
subContentView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.equalTo(182)
}
subContentView.addSubview(bigImageView)
bigImageView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(182)
}
}
}
//
// YHDavidCell0.swift
// galaxy
//
// Created by davidhuangA on 2024/1/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHDavidCell2: UITableViewCell {
static let cellReuseIdentifier = "YHDavidCell2"
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
setupUI()
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
lazy var bigImageView: UIImageView = {
let imagV = UIImageView()
imagV.contentMode = .scaleToFill
imagV.image = UIImage(named: "home_cell1_bkg")
return imagV
}()
lazy var subContentView : UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0x999999, alpha: 1.0)
view.layer.cornerRadius = kCornerRadius6
view.layer.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1).cgColor
view.layer.cornerRadius = 10
view.layer.borderWidth = 0.5
view.layer.borderColor = UIColor(red: 0.862, green: 0.862, blue: 0.862, alpha: 1).cgColor
return view
}()
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
contentView.addSubview(subContentView)
subContentView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.equalTo(99)
}
}
}
//
// YHDavidCell0.swift
// galaxy
//
// Created by davidhuangA on 2024/1/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHDavidCell3: UITableViewCell {
static let cellReuseIdentifier = "YHDavidCell3"
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
setupUI()
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
lazy var bigImageView: UIImageView = {
let imagV = UIImageView()
imagV.contentMode = .scaleToFill
imagV.image = UIImage(named: "home_cell1_bkg")
return imagV
}()
lazy var subContentView : UIView = {
let view = UIView()
view.layer.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1).cgColor
return view
}()
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
contentView.addSubview(subContentView)
subContentView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(138)
}
let bbxLable = UILabel()
bbxLable.text = "银河推荐官"
bbxLable.textColor = UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1)
bbxLable.font = UIFont.PFSC_R(ofSize: 18)
subContentView.addSubview(bbxLable)
bbxLable.snp.makeConstraints { make in
make.top.equalTo(13)
make.left.equalTo(25)
}
let desLable = UILabel()
desLable.text = "邀请拉新,合作共赢"
desLable.frame = CGRect(x: 0, y: 0, width: 141.5, height: 11.5)
desLable.textColor = UIColor(red: 0.592, green: 0.592, blue: 0.592, alpha: 1)
desLable.font = UIFont.PFSC_R(ofSize: 10)
subContentView.addSubview(desLable)
desLable.snp.makeConstraints { make in
make.left.equalTo(bbxLable.snp.right).offset(11)
make.centerY.equalTo(bbxLable)
}
}
}
//
// YHDavidCell0.swift
// galaxy
//
// Created by davidhuangA on 2024/1/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import FSPagerView
class YHDavidCell4: UITableViewCell {
fileprivate var dataArr: [YHBannerModel] = [YHBannerModel(),YHBannerModel(),YHBannerModel(),YHBannerModel(),YHBannerModel()]
static let cellHeight : CGFloat = 88 + 20
static let cellReuseIdentifier = "YHDavidCell4"
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
setupUI()
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
lazy var subContentView : UIView = {
let view = UIView()
// view.backgroundColor = .red
return view
}()
private lazy var bannerView: FSPagerView = {
let view = FSPagerView()
view.delegate = self
view.dataSource = self
view.automaticSlidingInterval = 2
view.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell")
view.itemSize = FSPagerView.automaticSize
view.interitemSpacing = 10
view.isInfinite = true
return view
}()
lazy var pageControl: FSPageControl = {
let view = FSPageControl()
return view
}()
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
contentView.addSubview(subContentView)
subContentView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalToSuperview()
}
subContentView.addSubview(bannerView)
bannerView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(80)
}
subContentView.addSubview(pageControl)
pageControl.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(bannerView.snp.bottom)
make.height.equalTo(20)
}
setupPageControl()
bannerView.reloadData()
}
func setupPageControl() {
self.pageControl.numberOfPages = self.dataArr.count
self.pageControl.contentHorizontalAlignment = .center
let normalImage = UIImage(color: .white, size: CGSize(width: 15, height: 5))
let selectImage = UIImage(color: UIColor(hex: 0xff0000, alpha: 1.0), size: CGSize(width: 20, height: 5))
self.pageControl.setImage(normalImage, for: .normal)
self.pageControl.setImage(selectImage, for: .selected)
self.pageControl.interitemSpacing = 15
}
}
// MARK: - FSPagerViewDelegate
extension YHDavidCell4: FSPagerViewDataSource, FSPagerViewDelegate {
public func numberOfItems(in pagerView: FSPagerView) -> Int {
return self.dataArr.count
}
public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell {
let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index)
let image = UIImage(named: "default_placeholder_image")?.bs_scaled(toWidth: UIDevice.kScreenW - 16*2, opaque: false)
cell.imageView?.image = image
if index < dataArr.count {
let model = dataArr[index]
if let url = URL(string: model.img_url) {
cell.imageView?.kf.setImage(with: url)
}
// cell.textLabel?.text = model.title
}
cell.imageView?.contentMode = .scaleAspectFill
cell.backgroundColor = .contentBkgColor
cell.contentView.layer.shadowColor = UIColor.clear.cgColor
return cell
}
func pagerViewWillEndDragging(_ pagerView: FSPagerView, targetIndex: Int) {
self.pageControl.currentPage = targetIndex
}
func pagerViewDidEndScrollAnimation(_ pagerView: FSPagerView) {
self.pageControl.currentPage = pagerView.currentIndex
}
}
//
// YHDavidCell0.swift
// galaxy
//
// Created by davidhuangA on 2024/1/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHDavidCell5: UITableViewCell {
static let cellHeight : CGFloat = 219
static let cellReuseIdentifier = "YHDavidCell5"
let items : [Int32] = [1,2,3,4,5,6,7,8]
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
setupUI()
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
lazy var subContentView : UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
var myCollectView : UICollectionView!
// lazy var myCollectView = {
// // 设置布局方向
//
//
//
// return collectinoView
// }()
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
contentView.addSubview(subContentView)
subContentView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
let bbxLable = UILabel()
bbxLable.text = "百宝箱"
bbxLable.textColor = UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1)
bbxLable.font = UIFont.PFSC_R(ofSize: 18)
subContentView.addSubview(bbxLable)
bbxLable.snp.makeConstraints { make in
make.top.equalTo(13)
make.left.equalTo(25)
}
let desLable = UILabel()
desLable.text = "香港本地宝,智慧小助手"
desLable.frame = CGRect(x: 0, y: 0, width: 141.5, height: 11.5)
desLable.textColor = UIColor(red: 0.592, green: 0.592, blue: 0.592, alpha: 1)
desLable.font = UIFont.PFSC_R(ofSize: 10)
subContentView.addSubview(desLable)
desLable.snp.makeConstraints { make in
make.left.equalTo(bbxLable.snp.right).offset(11)
make.centerY.equalTo(bbxLable)
}
// subContentView.backgroundColor = UIColor(hex: 0x999999)
let flowLayout = UICollectionViewFlowLayout()
let margin = 16.0
let gap = 20.0
let itemWidth = 80.0
flowLayout.itemSize = CGSize(width: itemWidth, height: 64)
flowLayout.minimumInteritemSpacing = (KScreenWidth - 2 * 16 - 2*16 - 4 * itemWidth)/4
flowLayout.minimumLineSpacing = 15.0
flowLayout.scrollDirection = .vertical
let collectinoView = YHGestureCollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectinoView.contentInset = UIEdgeInsets(top: 0, left: margin, bottom: 20, right: margin)
collectinoView.backgroundColor = .white
collectinoView.register(YHBbxCollectionViewCell.self, forCellWithReuseIdentifier:YHBbxCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true
myCollectView = collectinoView
myCollectView.isScrollEnabled = false
subContentView.addSubview(myCollectView)
myCollectView.snp.makeConstraints { make in
make.top.equalTo(bbxLable.snp.bottom).offset(15)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-20)
}
}
}
extension YHDavidCell5: UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHBbxCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHBbxCollectionViewCell
return cell
}
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("index is \(indexPath.row)")
}
}
//
// YHDavidTestCollectionViewCell.swift
// galaxy
//
// Created by davidhuangA on 2024/1/10.
// Copyright © 2024 www.davidhuang.com. All rights reserved.
//
import UIKit
class YHDavidTestCollectionViewCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHDavidTestCollectionViewCell"
lazy var titleImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "start_page_bkg"))
imageV.contentMode = .scaleAspectFill
imageV.roundCorners(UIRectCorner.topLeft, radius: 8)
imageV.roundCorners(UIRectCorner.topRight, radius: 8)
return imageV
}()
lazy var descripeLable:UILabel = {
let label = UILabel()
label.text = "赴港攻略,当日往返无忧,这个季节风景..赴港攻略,当日往返无忧,这个季节风景"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
label.numberOfLines = 2
label.lineBreakMode = .byTruncatingTail
return label
}()
lazy var headImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "home_person_icon"))
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var nameLable:UILabel = {
let label = UILabel()
label.text = "Fiona"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
return label
}()
lazy var dateLable:UILabel = {
let label = UILabel()
label.text = "12-12"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
return label
}()
lazy var heartImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "home_red_heart"))
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var numLable:UILabel = {
let label = UILabel()
label.text = "2000"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 14)
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
private func setupUI() {
contentView.backgroundColor = UIColor(hexString: "#F8F9FB")
contentView.roundCorners([.topLeft,.topRight], radius: 4)
contentView.clipsToBounds = true
contentView.addSubview(titleImageView)
titleImageView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(210)
}
let subHoldView = UIView()
subHoldView.layer.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1).cgColor
subHoldView.layer.borderWidth = 0.5
subHoldView.layer.borderColor = UIColor(red: 0.798, green: 0.798, blue: 0.798, alpha: 1).cgColor
contentView.addSubview(subHoldView)
subHoldView.snp.makeConstraints { make in
make.top.equalTo(titleImageView.snp.bottom).offset(4)
make.left.right.equalToSuperview()
make.height.equalTo(87)
}
subHoldView.addSubview(descripeLable)
descripeLable.snp.makeConstraints { make in
make.top.equalToSuperview().offset(8)
make.left.equalToSuperview().offset(8)
make.right.equalToSuperview().offset(-8)
make.height.equalTo(30)
}
subHoldView.addSubview(headImageView)
headImageView.snp.makeConstraints { make in
make.top.equalTo(descripeLable.snp.bottom).offset(10)
make.left.equalTo(descripeLable.snp.left)
make.height.width.equalTo(25)
}
subHoldView.addSubview(nameLable)
nameLable.snp.makeConstraints { make in
make.top.equalTo(headImageView.snp.top)
make.left.equalTo(headImageView.snp.right).offset(5)
make.height.equalTo(12)
make.width.equalTo(50)
}
subHoldView.addSubview(dateLable)
dateLable.snp.makeConstraints { make in
make.top.equalTo(nameLable.snp.bottom).offset(2)
make.left.equalTo(nameLable.snp.left)
make.height.equalTo(12)
make.right.equalTo(nameLable.snp.right)
}
subHoldView.addSubview(numLable)
numLable.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-8)
make.height.equalTo(12)
make.centerY.equalTo(headImageView.snp.centerY)
}
subHoldView.addSubview(heartImageView)
heartImageView.snp.makeConstraints { make in
make.right.equalTo(numLable.snp.left).offset(-6)
make.height.width.equalTo(12)
make.centerY.equalTo(headImageView.snp.centerY)
}
}
}
......@@ -18,11 +18,6 @@ extension YHGestureTableView: UIGestureRecognizerDelegate {
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
// open override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
// return true
// }
}
......@@ -38,11 +33,6 @@ extension YHGestureScrollView: UIGestureRecognizerDelegate {
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
// open override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
// return true
// }
}
......@@ -57,9 +47,4 @@ extension YHGestureCollectionView: UIGestureRecognizerDelegate {
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
// open override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
// return true
// }
}
......@@ -95,6 +95,9 @@ private extension YHHkLifeAndIdItemView {
make.height.equalTo(16)
make.right.equalTo(titleLable.snp.right)
}
let tap = UITapGestureRecognizer(target: self, action: #selector(tapView(gestureRecognizer:)))
addGestureRecognizer(tap)
}
......@@ -113,4 +116,17 @@ private extension YHHkLifeAndIdItemView {
printLog("errorr:未处理")
}
}
@objc func tapView(gestureRecognizer:UITapGestureRecognizer) {
if itemType == .hkID {
//香港身份
} else if itemType == .hklife {
//香港生活
} else {
printLog("errorr:未处理")
}
}
}
//
// YHHomeCustomCell.swift
// galaxy
//
// Created by davidhuangA on 2024/1/10.
// Copyright © 2024 www.davidhuang.com. All rights reserved.
//
import UIKit
class YHHomeCustomCell: UITableViewCell {
static let cellReuseIdentifier = "YHHomeCustomCell"
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),
AboutAdvantageItem(iconName: "about_response", title: "快速响应", detail: "身份规划师一对一专业服务,第一时间响应您的需求", url: ""),
AboutAdvantageItem(iconName: "about_service", title: "专业服务", detail: "5年经验+英语专8级文案导师团队倾力支持", url: ""),
AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上", url: "")]
}()
var dataArray: [String] = [] // 假定我们的数据结构就是一个String数组
var collectionView: UICollectionView!
var collectionContainer: UIView!
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
// 设置布局方向
let flowLayout = UICollectionViewFlowLayout()
let margin = 18.0
let gap = 12.0
let itemWidth = floor((KScreenWidth-2*margin-gap)/2.0)
flowLayout.itemSize = CGSize(width: itemWidth, height: itemWidth)
flowLayout.minimumInteritemSpacing = 12.0
flowLayout.minimumLineSpacing = 12.0
flowLayout.scrollDirection = .vertical
collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.contentInset = UIEdgeInsets(top: 0, left: margin, bottom: 0, right: margin)
collectionView.backgroundColor = UIColor.white
collectionView.register(YHAboutUsAdvantageCell.self, forCellWithReuseIdentifier:YHAboutUsAdvantageCell.cellReuseIdentifier)
collectionView.delegate = self
collectionContainer = UIView(frame: .zero)
contentView.addSubview(collectionContainer)
collectionContainer.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(0)
}
collectionContainer.addSubview(collectionView)
collectionView.snp.makeConstraints({ make in
make.edges.equalToSuperview()
})
// collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "test")
// collectionView.delegate = self // 这里根据具体业务写吧,demo中我就把代理直接设置成cell了..
// collectionView.dataSource = self // 根据业务,demo直接先cell持有数据来控制collectionView的显示了..
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// 外部调用,用来设置collectionView的数据源
func setData(_ data: [String]) {
self.dataArray = data
collectionView.reloadData()
// 这里需要 layoutIfNeeded 一下,否则我们不能同步拿到contentSize
// 注意,如果上面collectionContainer的布局没有指明宽度,这个时候cell的宽度是estimate状态,所以下面就算layout也拿不到正确的contentSize
collectionView.layoutIfNeeded()
let height = collectionView.contentSize.height
printLog(height)
collectionContainer.snp.updateConstraints { make in
make.height.equalTo(height)
}
}
}
extension YHHomeCustomCell: UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHAboutUsAdvantageCell.cellReuseIdentifier, for: indexPath) as! YHAboutUsAdvantageCell
cell.advantateItem = items[indexPath.row]
return cell
}
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("index is \(indexPath.row)")
}
}
......@@ -31,7 +31,6 @@ class YHHomeKingKongBlockItem: UIView {
label.font = UIFont.PFSC_M(ofSize: 12)
label.lineBreakMode = .byTruncatingMiddle
label.textAlignment = .center
// label.minimumScaleFactor = 0.5
return label
}()
......
//
// YHHomeViewController.swift
// YHServiceCenterMainViewController.swift
// galaxy
//
// Created by EDY on 2023/12/20.
......
......@@ -174,9 +174,11 @@ private extension YHHKPlanItemView {
if model.canEditFlag {
myTextView.isEditable = true
myTextView.isSelectable = true
myTextView.textColor = UIColor.mainTextColor
} else {
myTextView.isEditable = false
myTextView.isSelectable = false
myTextView.textColor = UIColor(hex: 0x222222, alpha: 0.5)
myTextView.wrapToContent()
}
......
......@@ -8,6 +8,8 @@
import UIKit
import Kingfisher
import AVFoundation
import AVKit
class YHHomeCollectionViewCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHHomeCollectionViewCell"
......@@ -34,8 +36,8 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
lazy var descripeLable:UILabel = {
let label = UILabel()
label.text = "赴港攻略,当日往返无忧,这个季节风景..赴港攻略,当日往返无忧,这个季节风景"
label.textColor = UIColor(hexString:"#333333")
label.text = ""
label.textColor = UIColor(hex: 0x121A26, alpha: 1.0)
label.font = UIFont.PFSC_R(ofSize: 14)
label.numberOfLines = 2
label.lineBreakMode = .byWordWrapping
......@@ -73,6 +75,34 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
setupUI()
}
lazy var playButton: UIButton = {
let btn = UIButton(type: .custom)
btn.setImage(UIImage(named: "home_play_btn"), for: .normal)
btn.isHidden = true
return btn
}()
lazy var playerViewController: AVPlayerViewController = {
let vc = AVPlayerViewController()
return vc
}()
}
extension YHHomeCollectionViewCell {
@objc func clickPlayButton() {
guard let listModel = listModel else { return }
//"https://upload.cdn.galaxy-immi.com/sell/production/video/1638527500518.mp4"
if listModel.media_url.isEmpty == false,let url = URL(string: listModel.media_url) {
let player = AVPlayer(url:url)
playerViewController.player = player
self.parentViewController?.present(playerViewController, animated: true) {
self.playerViewController.player!.play() // 开始播放视频
}
}
}
private func setupUI() {
contentView.clipsToBounds = true
contentView.addSubview(titleImageView)
......@@ -115,6 +145,16 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
heartImageViewBtn.addTarget(self, action: #selector(clickHeart), for: .touchUpInside)
heartImageViewBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)
contentView.addSubview(playButton)
playButton.snp.makeConstraints { make in
make.top.equalToSuperview().offset(8)
make.right.equalToSuperview().offset(-8)
make.width.height.equalTo(20)
}
playButton.addTarget(self, action: #selector(clickPlayButton), for: .touchUpInside)
}
func updataSubViews() {
......@@ -137,8 +177,16 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
}
numLable.text = listModel.collect_count.string
heartImageViewBtn.isSelected = listModel.is_like
if listModel.type == 1 {
playButton.isHidden = false
} else {
playButton.isHidden = true
}
}
@objc func clickHeart() {
guard let listModel = listModel else { return }
......
//
// YHMyNotifySettingVC.swift
// galaxy
//
// Created by edy on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyNotifySettingVC: YHBaseViewController {
var items:[YHPermissionItem] = [YHPermissionItem(title: "接收推送消息通知".local, enableStatus: false)]
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = .white
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHMyPermissionCell.self, forCellReuseIdentifier: YHMyPermissionCell.cellReuseIdentifier)
return tableView
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
func setupUI() {
gk_navTitle = "通知设置".local
view.backgroundColor = .white
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-k_Height_TabBar)
}
}
}
extension YHMyNotifySettingVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyPermissionCell.cellReuseIdentifier, for: indexPath) as! YHMyPermissionCell
if 0 <= indexPath.row && indexPath.row < items.count {
let item = items[indexPath.row]
cell.updateModel(item)
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 53.0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return UITableView.automaticDimension
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xF8FAFB)
let label = UILabel()
label.textColor = UIColor(hex: 0x121A26, alpha: 0.5)
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:12)
label.numberOfLines = 0
label.text = "允许银河APP向您发送通知,可以及时了解到服务进度提醒、政策解读等系统通知".local
view.addSubview(label)
label.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalToSuperview().offset(12)
make.bottom.equalToSuperview().offset(-12)
}
return view
}
}
//
// YHMyPermissionSettingVC.swift
// galaxy
//
// Created by edy on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHPermissionItem {
var title:String = ""
var enableStatus:Bool = false
init(title: String, enableStatus: Bool) {
self.title = title
self.enableStatus = enableStatus
}
}
class YHMyPermissionSettingVC: YHBaseViewController {
var items:[YHPermissionItem] = [YHPermissionItem(title: "网络".local, enableStatus: true),
YHPermissionItem(title: "照片".local, enableStatus: true),
YHPermissionItem(title: "相机".local, enableStatus: false),
YHPermissionItem(title: "位置".local, enableStatus: true),
YHPermissionItem(title: "文件".local, enableStatus: false)]
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = .white
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHMyPermissionCell.self, forCellReuseIdentifier: YHMyPermissionCell.cellReuseIdentifier)
return tableView
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
func setupUI() {
gk_navTitle = "权限设置".local
view.backgroundColor = .white
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-k_Height_TabBar)
}
}
}
extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyPermissionCell.cellReuseIdentifier, for: indexPath) as! YHMyPermissionCell
if 0 <= indexPath.row && indexPath.row < items.count {
let item = items[indexPath.row]
cell.updateModel(item)
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 53.0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return UITableView.automaticDimension
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xF8FAFB)
let label = UILabel()
label.textColor = UIColor(hex: 0x121A26, alpha: 0.5)
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:12)
label.numberOfLines = 0
label.text = "为了更好的使用体验,银河在特定场景会向您申请手机系统权限。您可以随时在手机系统设置中修改".local
view.addSubview(label)
label.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalToSuperview().offset(12)
make.bottom.equalToSuperview().offset(-12)
}
return view
}
}
......@@ -36,8 +36,8 @@ class YHMySettingViewController: YHBaseViewController, ConstraintRelatableTarget
}()
lazy var items: [PersonalModuleItem] = {
return [PersonalModuleItem(title: "调整设置".local, type:.changeSettings),
PersonalModuleItem(title: "深色模式".local, type:.darkMode),
return [PersonalModuleItem(title: "通知设置".local, type:.notifySettings),
PersonalModuleItem(title: "权限配置".local, type:.permissionSettings),
PersonalModuleItem(title: "个人信息收集清单".local, type:.infoCollectList),
PersonalModuleItem(title: "第三方信息共享清单".local, type:.infoShareList),
PersonalModuleItem(title: "关于我们".local, type:.aboutUs)]
......@@ -84,8 +84,10 @@ extension YHMySettingViewController : UITableViewDelegate, UITableViewDataSource
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMySettingCell.cellReuseIdentifier, for: indexPath) as! YHMySettingCell
let item : PersonalModuleItem = items[indexPath.row];
cell.titleLabel.text = item.title
if 0 <= indexPath.row && indexPath.row < items.count {
let item : PersonalModuleItem = items[indexPath.row];
cell.titleLabel.text = item.title
}
return cell
}
......@@ -95,11 +97,20 @@ extension YHMySettingViewController : UITableViewDelegate, UITableViewDataSource
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (indexPath.row >= items.count) { return }
let item = items[indexPath.row]
if item.type == .aboutUs {
let vc = YHAboutUsViewController()
self.navigationController?.pushViewController(vc)
if 0 <= indexPath.row && indexPath.row < items.count {
let item = items[indexPath.row]
if item.type == .notifySettings {
let vc = YHMyNotifySettingVC()
self.navigationController?.pushViewController(vc)
} else if item.type == .permissionSettings {
let vc = YHMyPermissionSettingVC()
self.navigationController?.pushViewController(vc)
} else if item.type == .aboutUs {
let vc = YHAboutUsViewController()
self.navigationController?.pushViewController(vc)
}
}
}
}
......
......@@ -20,8 +20,8 @@ enum YHPersonalModuleItemType: Int {
case myTestCode
case appointGalaxyBay
case changeSettings
case darkMode
case notifySettings
case permissionSettings
case infoCollectList
case infoShareList
case aboutUs
......
//
// YHMyPermissionCell.swift
// galaxy
//
// Created by edy on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyPermissionCell: UITableViewCell {
static let cellReuseIdentifier = "YHMyPermissionCell"
static let enableColor = UIColor(hex: 0x121A26, alpha: 0.3)
static let disableColor = UIColor(hex: 0x121A26, alpha: 0.7)
var titleLabel: UILabel!
var statusLabel: UILabel!
var rightArrowImgV: UIImageView!
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
titleLabel = UILabel()
titleLabel.textColor = UIColor(hex:0x121A26)
titleLabel.textAlignment = .left
titleLabel.font = UIFont.PFSC_R(ofSize: 15)
contentView.addSubview(titleLabel)
statusLabel = UILabel()
statusLabel.textColor = Self.disableColor
statusLabel.textAlignment = .right
statusLabel.font = UIFont.PFSC_R(ofSize:15)
contentView.addSubview(statusLabel)
rightArrowImgV = UIImageView(image: UIImage(named: "service_center_right_next_icon"))
contentView.addSubview(rightArrowImgV)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.centerY.equalToSuperview()
make.right.equalTo(statusLabel.snp.left).offset(-10)
}
statusLabel.snp.makeConstraints { make in
make.right.equalTo(rightArrowImgV.snp.left).offset(-4)
make.size.equalTo(CGSize(width: 46, height: 21))
make.centerY.equalToSuperview()
}
rightArrowImgV.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-20)
make.size.equalTo(CGSize(width: 16, height: 16))
make.centerY.equalToSuperview()
}
}
func updateModel(_ model: YHPermissionItem) {
self.titleLabel.text = model.title
self.statusLabel.text = model.enableStatus ? "已开启".local : "未开启".local
self.statusLabel.textColor = model.enableStatus ? Self.enableColor : Self.disableColor
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "编组-21@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "编组-21@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment