Commit 388d859b authored by Steven杜宇's avatar Steven杜宇

// 我的模块

parent d9dd634a
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
04F526AF2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F526AE2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift */; };
04FAC5382B32B7FA00D24B36 /* YHTabbarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5372B32B7FA00D24B36 /* YHTabbarViewController.swift */; }; 04FAC5382B32B7FA00D24B36 /* YHTabbarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5372B32B7FA00D24B36 /* YHTabbarViewController.swift */; };
04FAC53A2B32B89D00D24B36 /* YHNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5392B32B89D00D24B36 /* YHNavigationViewController.swift */; }; 04FAC53A2B32B89D00D24B36 /* YHNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5392B32B89D00D24B36 /* YHNavigationViewController.swift */; };
04FAC5432B32BA5F00D24B36 /* YHHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5422B32BA5F00D24B36 /* YHHomeViewController.swift */; }; 04FAC5432B32BA5F00D24B36 /* YHHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5422B32BA5F00D24B36 /* YHHomeViewController.swift */; };
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
04F526AE2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPersonalCenterCell.swift; sourceTree = "<group>"; };
04FAC5372B32B7FA00D24B36 /* YHTabbarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTabbarViewController.swift; sourceTree = "<group>"; }; 04FAC5372B32B7FA00D24B36 /* YHTabbarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTabbarViewController.swift; sourceTree = "<group>"; };
04FAC5392B32B89D00D24B36 /* YHNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHNavigationViewController.swift; sourceTree = "<group>"; }; 04FAC5392B32B89D00D24B36 /* YHNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHNavigationViewController.swift; sourceTree = "<group>"; };
04FAC5422B32BA5F00D24B36 /* YHHomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeViewController.swift; sourceTree = "<group>"; }; 04FAC5422B32BA5F00D24B36 /* YHHomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeViewController.swift; sourceTree = "<group>"; };
...@@ -85,6 +87,14 @@ ...@@ -85,6 +87,14 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
04F526A92B32D3D500FC6CE6 /* View */ = {
isa = PBXGroup;
children = (
04F526AE2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift */,
);
path = View;
sourceTree = "<group>";
};
04FAC5352B32B79500D24B36 /* Base */ = { 04FAC5352B32B79500D24B36 /* Base */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -124,6 +134,7 @@ ...@@ -124,6 +134,7 @@
04FAC53D2B32B91700D24B36 /* My */ = { 04FAC53D2B32B91700D24B36 /* My */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04F526A92B32D3D500FC6CE6 /* View */,
04FAC53E2B32B95700D24B36 /* Controller */, 04FAC53E2B32B95700D24B36 /* Controller */,
); );
path = My; path = My;
...@@ -399,6 +410,7 @@ ...@@ -399,6 +410,7 @@
04FAC54A2B32CF1000D24B36 /* YHNetRequest.swift in Sources */, 04FAC54A2B32CF1000D24B36 /* YHNetRequest.swift in Sources */,
04FAC5452B32BA7000D24B36 /* YHMyViewController.swift in Sources */, 04FAC5452B32BA7000D24B36 /* YHMyViewController.swift in Sources */,
04FAC53A2B32B89D00D24B36 /* YHNavigationViewController.swift in Sources */, 04FAC53A2B32B89D00D24B36 /* YHNavigationViewController.swift in Sources */,
04F526AF2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift in Sources */,
04FAC5382B32B7FA00D24B36 /* YHTabbarViewController.swift in Sources */, 04FAC5382B32B7FA00D24B36 /* YHTabbarViewController.swift in Sources */,
04FAC5432B32BA5F00D24B36 /* YHHomeViewController.swift in Sources */, 04FAC5432B32BA5F00D24B36 /* YHHomeViewController.swift in Sources */,
); );
......
...@@ -6,24 +6,63 @@ ...@@ -6,24 +6,63 @@
// //
import UIKit import UIKit
import SnapKit
class YHMyViewController: YHBaseViewController { struct PersonalModuleItem {
var icon: String
var title: String
init(icon: String, title: String) {
self.icon = icon
self.title = title
}
}
class YHMyViewController: YHBaseViewController {
lazy var tableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style:.plain)
tableView.backgroundColor = UIColor.red
tableView.separatorStyle = .none
tableView.register(YHPersonalCenterCell.self, forCellReuseIdentifier: YHPersonalCenterCell.cellReuseIdentifier)
tableView.delegate = self
tableView.dataSource = self
return tableView
}()
lazy var items: [PersonalModuleItem] = {
return [PersonalModuleItem(icon: "", title: "我的管家"),
PersonalModuleItem(icon: "", title: "我的订单"),
PersonalModuleItem(icon: "", title: "我的合同"),
PersonalModuleItem(icon: "", title: "我的进度"),
PersonalModuleItem(icon: "", title: "我的积分"),
PersonalModuleItem(icon: "", title: "我的设置"),
PersonalModuleItem(icon: "", title: "关于我们"),]
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
print("11111") view.addSubview(tableView);
// Do any additional setup after loading the view. tableView.snp.makeConstraints { make in
make.left.right.top.bottom.equalTo(view)
}
} }
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Pass the selected object to the new view controller. return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHPersonalCenterCell.cellReuseIdentifier, for: indexPath) as! YHPersonalCenterCell
let item : PersonalModuleItem = items[indexPath.row];
cell.updateItem(item: item)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 50
} }
*/
} }
//
// YHPersonalCenterCell.swift
// galaxy
//
// Created by edy on 2023/12/20.
//
import UIKit
import SnapKit
class YHPersonalCenterCell: UITableViewCell {
static let cellReuseIdentifier = "YHPersonalCenterCell"
lazy var iconImgView:UIImageView = {
let icon = UIImageView()
icon.backgroundColor = UIColor.systemPink
return icon
}()
lazy var titleLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.red
label.textAlignment = NSTextAlignment.left
label.font = UIFont.systemFont(ofSize: 12)
label.text = "曾经沧海难为水,除却巫山不是云"
return label
}()
lazy var arrowImgView:UIImageView = {
let arrowImgView = UIImageView(image: UIImage(named: ""))
arrowImgView.backgroundColor = UIColor.purple
return arrowImgView
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func updateItem(item : PersonalModuleItem) {
iconImgView.image = UIImage(named: item.icon)
titleLabel.text = item.title;
}
func setupUI() {
contentView.addSubview(iconImgView)
contentView.addSubview(titleLabel)
contentView.addSubview(arrowImgView)
iconImgView.snp.makeConstraints { make in
make.left.equalTo(contentView.snp.left).offset(20)
make.centerY.equalTo(contentView)
make.width.height.equalTo(8)
}
titleLabel.snp.makeConstraints { make in
make.centerY.equalTo(contentView)
make.left.equalTo(iconImgView.snp.right).offset(10)
make.right.equalTo(arrowImgView.snp.left).offset(-20)
}
arrowImgView.snp.makeConstraints { make in
make.width.equalTo(5)
make.height.equalTo(10)
make.centerY.equalTo(contentView)
make.right.equalTo(contentView).offset(-20)
}
}
}
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