Commit 31e264ee authored by yqz's avatar yqz

Merge branch 'develop-taorui' into yQz0710

* develop-taorui:
  feat: 数据页面代码提交
  feat :首页UI

# Conflicts:
#	SpeakEasyLearnEnglish/SpeakEasyLearnEnglish/Classes/AppDelegate/AppDelegate.swift
#	SpeakEasyLearnEnglish/SpeakEasyLearnEnglish/Classes/Pages/HomePage/SpeakEleHomeViewCtr.swift
#	SpeakEasyLearnEnglish/SpeakEasyLearnEnglish/Classes/Pages/HomePage/SpeakEleHomeViewCtr.xib
parents 889b5118 06999bdc
{
"images" : [
{
"filename" : "sp-home-Back-Top.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-Back-Top@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-Back-Top@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-Start-Blue.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-Start-Blue@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-Start-Blue@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-Start-Green.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-Start-Green@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-Start-Green@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-Start-Red.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-Start-Red@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-Start-Red@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-Start-Yellow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-Start-Yellow@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-Start-Yellow@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-blue.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-blue@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-blue@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-gray.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-gray@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-gray@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-green.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-green@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-green@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-orange.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-orange@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-orange@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-red.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-red@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-red@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-xyellow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-xyellow@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-xyellow@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-book.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-book@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-book@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-clock.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-clock@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-clock@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-fire.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-fire@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-fire@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-flag.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-fresh.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-fresh@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-fresh@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-headerivar.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-pro.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-pro@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-pro@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-xuxianL.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-xuxianL@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-xuxianL@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-home-xuxianR.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-home-xuxianR@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-home-xuxianR@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-progress-Check.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-progress-Check@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-progress-Check@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-progress-Lfire.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-progress-Lfire@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-progress-Lfire@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sp-progress-Mfire.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sp-progress-Mfire@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sp-progress-Mfire@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
initData() initData()
// SpeakElePublicManager.share.PublicData.state = .home SpeakElePublicManager.share.PublicData.state = .home
#if DEBUG #if DEBUG
// // 获取所有可用字体家族名称 // // 获取所有可用字体家族名称
// let fontFamilyNames = UIFont.familyNames // let fontFamilyNames = UIFont.familyNames
......
...@@ -46,9 +46,17 @@ class SpeakEleTabbarViewCtr: UIViewController { ...@@ -46,9 +46,17 @@ class SpeakEleTabbarViewCtr: UIViewController {
self.addChild(setvc) self.addChild(setvc)
contentStack.addArrangedSubview(setvc.view) contentStack.addArrangedSubview(setvc.view)
let pro = TabbarButton(title: "Progress", normalImage: nil, selectImage: nil)
let provc = SpeakEleProgressViewCtr()
self.addChild(provc)
contentStack.addArrangedSubview(provc.view)
tabBarItems = [ tabBarItems = [
home, home,
set set,
pro
] ]
for (i,btn) in tabBarItems.enumerated() { for (i,btn) in tabBarItems.enumerated() {
btn.tag = i btn.tag = i
......
...@@ -39,3 +39,28 @@ public func Print(_ items: Any..., ...@@ -39,3 +39,28 @@ public func Print(_ items: Any...,
#else #else
#endif #endif
} }
/// 状态栏高度
var statusBarHeight: CGFloat {
// UIApplication.shared.statusBarFrame.height
UIApplication.shared.windows.first?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0.00
}
/// 导航栏高度
var naviBarHeight: CGFloat {
UINavigationController().navigationBar.frame.size.height
}
/// Tabbar高度
var tabbarHeight: CGFloat {
49.0 + tabbarSpace
}
/// Tabbar安全区域高度
var tabbarSpace: CGFloat {
isIphoneNotch ? 34 : 0
}
/// 是否刘海屏
var isIphoneNotch: Bool {
statusBarHeight > 20
}
...@@ -6,36 +6,123 @@ ...@@ -6,36 +6,123 @@
// //
import UIKit import UIKit
import SnapKit
class SpeakEleHomeViewCtr: SpeakEleBaseViewCtr { class SpeakEleHomeViewCtr: SpeakEleBaseViewCtr {
@IBOutlet weak var PlayerView: UIView! @IBOutlet weak var headerBoard: UIView!
lazy var mainScrollview: UIScrollView = {
let sView = UIScrollView()
sView.isUserInteractionEnabled = true
sView.isScrollEnabled = true
return sView
}()
lazy var levellb: UILabel = {
let lLabel = UILabel()
lLabel.text = "Entry-level"
lLabel.font = UIFont.montserrat(.regular ,size: 16)
lLabel.textColor = UIColor.init(with: "#000000", alpha: 0.4)
return lLabel
}()
lazy var leftline: UIView = {
let lineView = UIView()
lineView.backgroundColor = UIColor.init(with: "#000000", alpha: 0.4)
return lineView
}()
lazy var rightline: UIView = {
let lineV = UIView()
lineV.backgroundColor = UIColor.init(with: "#000000", alpha: 0.4)
return lineV
}()
lazy var topButton: UIButton = {
let button = UIButton.init(type: .custom)
button.setImage(UIImage(named: "sp-home-Back-Top"), for: .normal)
return button
}()
@IBOutlet weak var inputText: UITextField!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
makeUI()
makeLessonUI()
Print("输出状态栏高度\(statusBarHeight)")
} }
var index = 4
var lessonIndex = 9
@IBAction func voice(_ sender: Any) { func makeUI() {
self.view.layoutIfNeeded()
let sss = ["Practice Sanfu in summer and Sanjiu in winter, but on hot and humid Sanfu days, a slight movement can cause sweating and discomfort to the body.So what are the recommendations for exercising during the dog days when you want to maintain your health but don't want to sweat too much?","Hello, let's start learning the first lesson"] self.view.insertSubview(mainScrollview, belowSubview: headerBoard)
self.view.addSubview(topButton)
mainScrollview.addSubview(levellb)
mainScrollview.addSubview(leftline)
mainScrollview.addSubview(rightline)
let i = 0 mainScrollview.snp.makeConstraints { make in
let text = sss[i]//inputText.text ?? "" make.top.equalTo(statusBarHeight + 137.0)
make.left.equalTo(24)
make.right.equalTo(-24)
make.bottom.equalTo(-100)
}
let playerLayer = SpeakVideoPlayer.share.playerLayers levellb.snp.makeConstraints { make in
playerLayer?.frame = PlayerView.bounds make.centerX.equalToSuperview()
PlayerView.layer.addSublayer(playerLayer ?? CALayer()) make.top.equalTo(24)
}
let sb = [15.07,2.65]
let secend = sb[i] leftline.snp.makeConstraints { make in
let num = ceil(secend / 4.3) make.centerY.equalTo(levellb)
let rate = (num * 4.3) / secend make.right.equalTo(levellb.snp.left).offset(-8)
SpeakVideoPlayer.share.videoPlayer(rate,playCount: Int(num)) make.left.equalTo(16)
SpeakSpeechSynthesizer.share.speakText(text) make.height.equalTo(0.6)
}
rightline.snp.makeConstraints { make in
make.left.equalTo(levellb.snp.right).offset(8)
make.centerY.equalTo(levellb)
make.right.equalTo(self.view.snp.right).offset(-40)
make.height.equalTo(0.6)
}
topButton.snp.makeConstraints { make in
make.bottom.equalTo(-(tabbarHeight + 26))
make.right.equalTo(self.view.snp.right).offset(-16)
make.width.height.equalTo(48)
}
} }
func makeLessonUI() {
let btnW = 96, btnH = 176
mainScrollview.contentSize = CGSize(width: mainScrollview.bounds.width, height: 1000)
for num in 0...index {
let bx = num % 2 == 0 ? -160 : -20
let backV = UIImageView(frame: CGRect(x: Int((Dev.screenW))/2 + bx, y: num * 158 + 100, width: 141, height: 162))
let iname = num % 2 == 0 ? "sp-home-xuxianL" : "sp-home-xuxianR"
backV.image = UIImage(named: iname)
mainScrollview.addSubview(backV)
}
for num in 0...lessonIndex {
let lview = SpeakEleLessionView()
lview.setColor(type: num)
if num == 0 {
lview.frame = CGRect(x: Int((Dev.screenW))/2-70, y: 55, width: btnW, height: btnH)
} else if num == 1{
lview.frame = CGRect(x: Int((Dev.screenW))/2-70, y: 55 + 56 + 96, width: btnW, height: btnH)
} else if num % 4 == 0{
lview.frame = CGRect(x: Int((Dev.screenW))/2-195, y: 120 + num * 80, width: btnW, height: btnH)
} else if num % 2 == 0{
lview.frame = CGRect(x: Int((Dev.screenW))/2+61, y: 120 + num * 80, width: btnW, height: btnH)
} else {
lview.frame = CGRect(x: Int((Dev.screenW))/2-70, y: 120 + num * 80, width: btnW, height: btnH)
}
mainScrollview.addSubview(lview)
}
}
} }
//
// SpeakEleLessionView.swift
// SpeakEasyLearnEnglish
//
// Created by mac on 2025/7/15.
//
import UIKit
enum buttonColorType : String {
case red = "sp-home-red"
case blue = "sp-home-blue"
case yellow = "sp-home-xyellow"
case green = "sp-home-green"
case gray = "sp-home-gray"
case orange = "sp-home-orange"
}
class SpeakEleLessionView: UIView {
lazy var button: UIButton = {
let button = UIButton.init(type: .custom)
return button
}()
lazy var backView: UIView = {
let bView = UIView()
bView.backgroundColor = .white
return bView
}()
lazy var nameLb: UILabel = {
let nlb = UILabel()
nlb.font = UIFont.montserrat(.medium ,size: 14)
nlb.textColor = .black
nlb.text = "Music Prefences"
nlb.numberOfLines = 0
nlb.textAlignment = .center
return nlb
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.isUserInteractionEnabled = true
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setColor(type: Int) {
let colorArr: [buttonColorType] = [.blue,.orange,.green,.yellow,.red,.gray,.gray,.gray,.gray,.gray,.gray,.gray,.gray,.gray,.gray,.gray,.gray,.gray]
button.setImage(UIImage(named: colorArr[type].rawValue), for: .normal)
}
private func setupUI() {
self.addSubview(backView)
backView.addSubview(button)
self.addSubview(nameLb)
backView.snp.makeConstraints { make in
make.width.height.equalTo(96)
make.top.left.right.equalTo(0)
}
nameLb.snp.makeConstraints { make in
make.top.equalTo(backView.snp.bottom).offset(5)
make.left.right.equalTo(0)
}
button.snp.makeConstraints { make in
make.top.equalTo(5)
make.left.equalTo(6)
make.right.equalTo(-6)
make.bottom.equalTo(-8)
}
backView.corners = 48
backView.borderWidth = 4
backView.borderColor = UIColor.init(with: "#000000", alpha: 0.18)
}
}
//
// SpeakEleProgressViewCtr.swift
// SpeakEasyLearnEnglish
//
// Created by mac on 2025/7/15.
//
import UIKit
class SpeakEleProgressViewCtr: SpeakEleBaseViewCtr {
lazy var tableView: UITableView = {
let tV = UITableView()
tV.tableHeaderView = headerV
tV.backgroundColor = .clear
tV.separatorStyle = .none
tV.showsVerticalScrollIndicator = false
tV.register(SpeakEleDailyCell.self, forCellReuseIdentifier: SpeakEleDailyCell.className())
tV.register(SpeakEleChooseCell.self, forCellReuseIdentifier: SpeakEleChooseCell.className())
tV.register(SpeakEleLtimeCell.self, forCellReuseIdentifier: SpeakEleLtimeCell.className())
tV.register(SpeakEleReviewCell.self, forCellReuseIdentifier: SpeakEleReviewCell.className())
tV.register(SpeakEleOtherCell.self, forCellReuseIdentifier: SpeakEleOtherCell.className())
tV.delegate = self
tV.dataSource = self
return tV
}()
let headerV = SpeakEleProgressHeaderView(frame: CGRect(x: 0, y: 0, width: Dev.screenW, height: 40))
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.init(with: "#F6F7F9")
makeUI()
}
func makeUI() {
self.view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(statusBarHeight + 20)
make.left.right.equalTo(0)
make.bottom.equalTo(-tabbarHeight)
}
}
}
extension SpeakEleProgressViewCtr: UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: SpeakEleDailyCell.className(), for: indexPath) as! SpeakEleDailyCell
return cell
} else if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: SpeakEleChooseCell.className(), for: indexPath) as! SpeakEleChooseCell
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: SpeakEleChooseCell.className(), for: indexPath) as! SpeakEleChooseCell
return cell
}
}
//
// SpeakEleChooseCell.swift
// SpeakEasyLearnEnglish
//
// Created by mac on 2025/7/16.
//
import UIKit
class SpeakEleChooseCell: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.contentView.backgroundColor = .clear
self.backgroundColor = .clear
// 创建UI方法
creatUI()
// bindViewModel()
}
// 这个方法也是必须要实现的,和重写初始化方法在一起实现。
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
func creatUI() {
}
}
//
// SpeakEleDailyCell.swift
// SpeakEasyLearnEnglish
//
// Created by mac on 2025/7/16.
//
import UIKit
class SpeakEleDailyCell: UITableViewCell {
lazy var backView: UIView = {
let bView = UIView()
bView.backgroundColor = .white
bView.isUserInteractionEnabled = true
return bView
}()
lazy var imgView: UIImageView = {
let bView = UIImageView()
bView.image = UIImage(named: "sp-progress-Lfire")
return bView
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .black
label.font = UIFont.montserrat(.bold ,size: 20)
label.text = "Cumulative Streak:5"
return label
}()
lazy var line: UIView = {
let lineView = UIView()
lineView.backgroundColor = UIColor.init(with: "#000000", alpha: 0.12)
return lineView
}()
lazy var subTitleLabel: UILabel = {
let label = UILabel()
label.textColor = .black
label.font = UIFont.montserrat(.bold ,size: 20)
label.text = "Daily learning"
return label
}()
lazy var tipLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.init(with: "#000000", alpha: 0.54)
label.font = UIFont.montserrat(.bold ,size: 14)
label.text = "Maste more know edge every day"
return label
}()
lazy var scView: SpeakElePCView = {
let layout = UICollectionViewFlowLayout()
let collectionView = SpeakElePCView(frame: CGRect.zero, collectionViewLayout: layout)
layout.scrollDirection = .horizontal
collectionView.backgroundColor = .clear
return collectionView
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.contentView.backgroundColor = .clear
self.backgroundColor = .clear
// 创建UI方法
creatUI()
// bindViewModel()
}
// 这个方法也是必须要实现的,和重写初始化方法在一起实现。
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
func creatUI() {
self.contentView.addSubview(backView)
backView.addSubview(imgView)
backView.addSubview(titleLabel)
backView.addSubview(line)
backView.addSubview(subTitleLabel)
backView.addSubview(tipLabel)
backView.addSubview(scView)
backView.snp.makeConstraints { make in
make.left.equalTo(24)
make.right.equalTo(-24)
make.top.equalTo(18)
make.bottom.equalTo(-24)
make.height.equalTo(268)
}
backView.corners = 16
imgView.snp.makeConstraints { make in
make.width.height.equalTo(32)
make.left.equalTo(24)
make.top.equalTo(16)
}
titleLabel.snp.makeConstraints { make in
make.height.equalTo(28)
make.left.equalTo(imgView.snp.right).offset(8)
make.centerY.equalTo(imgView)
}
line.snp.makeConstraints { make in
make.height.equalTo(0.6)
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(titleLabel.snp.bottom).offset(18)
}
subTitleLabel.snp.makeConstraints { make in
make.height.equalTo(28)
make.left.equalTo(imgView.snp.left)
make.right.equalTo(-24)
make.top.equalTo(line.snp.bottom).offset(16)
}
tipLabel.snp.makeConstraints { make in
make.height.equalTo(20)
make.left.equalTo(imgView.snp.left)
make.right.equalTo(-24)
make.top.equalTo(subTitleLabel.snp.bottom).offset(16)
}
scView.snp.makeConstraints { make in
make.height.equalTo(100)
make.left.equalTo(imgView.snp.left)
make.right.equalTo(-24)
make.top.equalTo(tipLabel.snp.bottom).offset(14)
}
}
}
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