Commit 9c116077 authored by yqz's avatar yqz

ui优化

parent 1d514222
......@@ -20,10 +20,9 @@ class HomeViewController:BaseViewController {
fileprivate func junmToModule(_ cIndex: Int, _ self: HomeViewController) {
fileprivate func junmToModule(_ cIndex: String, _ self: HomeViewController) {
switch cIndex {
case 0 :
case HomeTabbarItemState.Charging.rawValue:
DispatchQueue.main.async {[weak self] in
......@@ -34,7 +33,7 @@ class HomeViewController:BaseViewController {
self.navigationController?.pushViewController(vc, animated: true)
}
break
case 1:
case HomeTabbarItemState.SecretSpace.rawValue:
DispatchQueue.main.async { [weak self] in
guard let self else {return}
......@@ -56,14 +55,14 @@ class HomeViewController:BaseViewController {
self.navigationController?.pushViewController(vc, animated: true)
}
}
case 2 :
case HomeTabbarItemState.Contacts.rawValue :
DispatchQueue.main.async {[weak self] in
guard let self else {return}
let vc:ContactViewController = ContactViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
break
case 3 :
case HomeTabbarItemState.EmailCleaner.rawValue :
DispatchQueue.main.async {[weak self] in
guard let self else {return}
if PMEmailManager.shareManager.loginUser != nil {
......@@ -75,7 +74,7 @@ class HomeViewController:BaseViewController {
}
}
break
case 4 :
case HomeTabbarItemState.Compress.rawValue :
DispatchQueue.main.async {[weak self] in
guard let self else {return}
let vc:CompressController = CompressController()
......@@ -178,8 +177,7 @@ class HomeViewController:BaseViewController {
guard let self else {return}
if let cIndex = index as? Int {
if let cIndex = index as? String {
// 先走广告策略
if AdvManager.shared.advTimeAfterInAPP <= 0{
if IAPManager.share.isSubscribed == false {
......
......@@ -28,6 +28,14 @@ func loadTabbarImtesSONFromBundle() -> [HomeTabbarItem]? {
}
}
enum HomeTabbarItemState : String {
case Charging = "Charging"
case SecretSpace = "Secret Space"
case Contacts = "Contacts"
case EmailCleaner = "Email Cleaner"
case Compress = "Compress"
}
struct HomeTabbarItem:Codable {
var normalImage:String
......
[
{
"normalImage": "ic_charging_home_pre",
"heightImage": "tabbar_Charging_high",
"text":"Charging",
},
{
"normalImage": "ic_secret_home_pre",
"heightImage": "tabbar_secret_hight",
"text":"Secret Space",
},
{
"normalImage": "ic_contacts_home_pre",
"heightImage": "tabbar_contacts_hight",
"text":"Contacts",
"normalImage": "ic_charging_home_pre",
"heightImage": "tabbar_Charging_high",
"text":"Charging",
},
{
"normalImage": "ic_cmpress_home_pre",
"heightImage": "tabbar_cmpress_high",
"text":"Compress",
},
{
"normalImage": "ic_email_home_pre",
......@@ -20,8 +20,8 @@
"text":"Email Cleaner",
},
{
"normalImage": "ic_cmpress_home_pre",
"heightImage": "tabbar_cmpress_high",
"text":"Compress",
}
"normalImage": "ic_contacts_home_pre",
"heightImage": "tabbar_contacts_hight",
"text":"Contacts",
},
]
......@@ -36,7 +36,7 @@ class HomeTabbarView:UIView {
private func addButton() {
let cW:CGFloat = (self.width - 16) / Double(tabbarItems.count)
let cW:CGFloat = (self.width - 32) / Double(tabbarItems.count)
let cH:CGFloat = 54
for (index,item) in tabbarItems.enumerated() {
......@@ -49,11 +49,11 @@ class HomeTabbarView:UIView {
btn.setTitle(item.text, for: .normal)
btn.addTarget(self, action: #selector(tabbarClick(_:)), for: .touchUpInside)
btn.width = cW
btn.tag = 10 + index
btn.height = cH
btn.y = safeHeight == 0 ? 6 : 12
btn.x = 8 + Double(index) * cW
btn.x = 16 + Double(index) * cW
btn.changBtnWithStytl(btnStyle: .imageTop, margin: 5)
self.addSubview(btn)
}
}
......@@ -65,14 +65,15 @@ class HomeTabbarView:UIView {
}
@objc func tabbarClick(_ btn:UIButton) {
let btnText = btn.titleLabel?.text
for (index, item) in tabbarItems.enumerated() {
if item.text == btnText {
indexCallBack(index)
}
}
let tm = tabbarItems[btn.tag % 10]
indexCallBack(tm.text)
// let btnText = btn.titleLabel?.text
//
// for (index, item) in tabbarItems.enumerated() {
// if item.text == btnText {
// indexCallBack(index)
// }
// }
}
......
......@@ -130,14 +130,14 @@ class HomeView:UIView {
backgroundColor = .clear
clipsToBounds = true
homeTabbarView = HomeTabbarView(frame: CGRect(x: 0, y: 0, width: self.width, height: safeHeight + 66))
homeTabbarView = HomeTabbarView(frame: CGRect(x: 0, y: 0, width: self.width, height: safeHeight + 80))
self.addSubview(homeTabbarView!)
homeTabbarView?.snp.makeConstraints({ make in
make.bottom.centerX.width.equalToSuperview()
make.height.equalTo(safeHeight + 66)
make.height.equalTo(safeHeight + 80)
})
homeTabbarView?.indexCallBack = {[weak self] index in
......
......@@ -48,7 +48,7 @@ class HomeTitleCollectionCell:UICollectionViewCell {
titleLabel = UILabel()
titleLabel.font = UIFont.systemFont(ofSize: 16, weight: .bold)
titleLabel.font = UIFont.systemFont(ofSize: 18, weight: .bold)
titleLabel.textColor = UIColor.colorWithHex(hexStr: black3Color)
fileLabel = UILabel()
......
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