-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
174 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
BottomBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
BottomBar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
BottomBar.xcodeproj/xcuserdata/darren.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
BottomBar.xcodeproj/xcuserdata/darren.xcuserdatad/xcschemes/xcschememanagement.plist
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// | ||
// RootTabBarItem.swift | ||
// BottomBar | ||
// | ||
// Created by 全达晖 on 2020/9/3. | ||
// Copyright © 2020 全达晖. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class RootTabBarItem: UIView { | ||
// 对外暴露 | ||
var icon: String! { | ||
didSet{ | ||
swappableImageView.image = UIImage.init(named: icon) | ||
} | ||
} | ||
var title: String! { | ||
didSet { | ||
titleLabel.text = title | ||
} | ||
} | ||
var titleColor: UIColor! { | ||
didSet { | ||
titleLabel.textColor = titleColor | ||
} | ||
} | ||
|
||
// 私有属性 | ||
fileprivate | ||
var swappableImageView: UIImageView! | ||
var titleLabel: UILabel! | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
swappableImageView = UIImageView() | ||
self.addSubview(swappableImageView) | ||
|
||
titleLabel = UILabel() | ||
titleLabel.textAlignment = .center | ||
titleLabel.font = .systemFont(ofSize: 10) | ||
titleLabel.numberOfLines = 0; | ||
titleLabel.textColor = .systemGray | ||
self.addSubview(titleLabel) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
|
||
// 图片和文字 模式 | ||
if icon.count > 0 && title.count > 0 { | ||
let imgW: CGFloat = 22 | ||
let imgH: CGFloat = imgW | ||
let imgX: CGFloat = (self.frame.width - imgW) / 2 | ||
let imgY: CGFloat = 0 | ||
swappableImageView.frame = CGRect.init(x: imgX, y: imgY, width: imgW, height: imgH) | ||
|
||
let titleX: CGFloat = 0 | ||
let titleY: CGFloat = swappableImageView.frame.maxY + 5 | ||
let titleW: CGFloat = self.frame.width; | ||
let titleH: CGFloat = 18 | ||
titleLabel.frame = CGRect.init(x: titleX, y: titleY, width: titleW, height: titleH) | ||
} | ||
// 只有图片 模式 主题 | ||
else { | ||
swappableImageView.bounds = self.bounds | ||
} | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters