Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final class CustomNavigation: UIView {
- @IBOutlet weak var leftBarBut2: UIButton!
- @IBOutlet var navView: UIView!
- @IBOutlet weak var backBut: UIButton!
- @IBOutlet weak var leftBarBut: UIButton!
- @IBOutlet weak var largeTitle: UILabel!
- @IBOutlet weak var smallTitle: UILabel!
- var title: String = "" {
- didSet {
- largeTitle.text = title
- }
- }
- var subTitle: String = "" {
- didSet {
- smallTitle.text = subTitle
- }
- }
- var isSubTitleHidden: Bool {
- set {
- smallTitle.isHidden = newValue
- }
- get {
- return smallTitle.isHidden
- }
- }
- var isBackButtonHidden: Bool {
- set {
- backBut.isHidden = newValue
- }
- get {
- return backBut.isHidden
- }
- }
- var isLeftBarButtonHidden: Bool {
- set {
- leftBarBut.isHidden = newValue
- }
- get {
- return leftBarBut.isHidden
- }
- }
- var isLeftBarButton2Hidden: Bool {
- set {
- leftBarBut2.isHidden = newValue
- }
- get {
- return leftBarBut2.isHidden
- }
- }
- override func awakeFromNib() {
- self.clipsToBounds = true
- initWithNib()
- }
- private func initWithNib() {
- Bundle.main.loadNibNamed("CustomNavigation", owner: self, options: nil)
- navView.translatesAutoresizingMaskIntoConstraints = false
- addSubview(navView)
- setupLayout()
- }
- private func setupLayout() {
- NSLayoutConstraint.activate([
- navView.topAnchor.constraint(equalTo: topAnchor),
- navView.leadingAnchor.constraint(equalTo: leadingAnchor),
- navView.bottomAnchor.constraint(equalTo: bottomAnchor),
- navView.trailingAnchor.constraint(equalTo: trailingAnchor)
- ])
- }
- }
Add Comment
Please, Sign In to add comment