Commit 9c116077 authored by yqz's avatar yqz

ui优化

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