Skip to content

Commit

Permalink
Version 1.4.2
Browse files Browse the repository at this point in the history
- Made AZTabBarController `open`. Now the class can be subclassed and extended. Close #48.
- Fixed bug when unwrapping optional values. Close #53.
- Fixed bug where highlighted button title would not get the highlight tint. Close #41.
  • Loading branch information
Minitour committed Apr 12, 2019
1 parent e62b274 commit c5f7484
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 82 deletions.
2 changes: 1 addition & 1 deletion AZTabBar.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "AZTabBar"
s.version = "1.4.1"
s.version = "1.4.2"
s.summary = "A custom tab bar controller for iOS written in Swift 3.0"
s.homepage = "https://github.com/Minitour/AZTabBarController"
s.license = "MIT"
Expand Down
67 changes: 34 additions & 33 deletions AZTabBarController/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,79 +42,80 @@ class ViewController: UIViewController {


//init
//tabController = AZTabBarController.insert(into: self, withTabIconNames: icons)
tabController = AZTabBarController.insert(into: self, withTabIcons: icons, andSelectedIcons: sIcons)
//tabController = .insert(into: self, withTabIconNames: icons)
tabController = .insert(into: self, withTabIcons: icons, andSelectedIcons: sIcons)

//set delegate
tabController.delegate = self

//set child controllers



tabController.setViewController(ColorSelectorController.instance(), atIndex: 0)

let darkController = getNavigationController(root: LabelController.controller(text: "Search", title: "Recents"))
darkController.navigationBar.barStyle = .black
darkController.navigationBar.isTranslucent = false
darkController.navigationBar.barTintColor = #colorLiteral(red: 0.2039215686, green: 0.2862745098, blue: 0.368627451, alpha: 1)


tabController.setViewController(UIViewController(), atIndex: 1)

tabController.setViewController(getNavigationController(root: LabelController.controller(text: "You should really focus on the tab bar.", title: "Chat")), atIndex: 3)

tabController.setViewController(getNavigationController(root: LabelController.controller(text: "You should really focus on the tab bar.",
title: "Chat")),
atIndex: 3)

let buttonController = ButtonController.controller(badgeCount: 0, currentIndex: 4)
tabController.setViewController(getNavigationController(root: buttonController), atIndex: 4)


//customize

let color = UIColor(red: 14.0/255, green: 122.0/255, blue: 254.0/255, alpha: 1.0)

tabController.selectedColor = color

tabController.highlightColor = color

tabController.highlightedBackgroundColor = #colorLiteral(red: 0.1803921569, green: 0.8, blue: 0.4431372549, alpha: 1)

tabController.defaultColor = .lightGray

//tabController.highlightButton(atIndex: 2)
tabController.buttonsBackgroundColor = UIColor(red: (247.0/255), green: (247.0/255), blue: (247.0/255), alpha: 1.0)//#colorLiteral(red: 0.2039215686, green: 0.2862745098, blue: 0.368627451, alpha: 1)

tabController.buttonsBackgroundColor = UIColor(red: (247.0/255), green: (247.0/255), blue: (247.0/255), alpha: 1.0)

tabController.selectionIndicatorHeight = 0

tabController.selectionIndicatorColor = color

tabController.tabBarHeight = 60

tabController.notificationBadgeAppearance.backgroundColor = .red
tabController.notificationBadgeAppearance.textColor = .white
tabController.notificationBadgeAppearance.borderColor = .clear
tabController.notificationBadgeAppearance.borderWidth = 0.2



tabController.setBadgeText("!", atIndex: 4)

tabController.setIndex(10, animated: true)

tabController.setAction(atIndex: 3){
self.counter = 0
self.tabController.setBadgeText(nil, atIndex: 3)
}

tabController.setAction(atIndex: 2) {
self.tabController.onlyShowTextForSelectedButtons = !self.tabController.onlyShowTextForSelectedButtons
}

tabController.setAction(atIndex: 4) {
//self.tabController.setBar(hidden: true, animated: true)
}

tabController.setIndex(1, animated: true)

tabController.animateTabChange = true
tabController.onlyShowTextForSelectedButtons = false
tabController.setTitle("Home", atIndex: 0)
Expand All @@ -123,7 +124,7 @@ class ViewController: UIViewController {
tabController.setTitle("Feed", atIndex: 3)
tabController.setTitle("Profile", atIndex: 4)
tabController.font = UIFont(name: "AvenirNext-Regular", size: 12)

let container = tabController.buttonsContainer
container?.layer.shadowOffset = CGSize(width: 0, height: -2)
container?.layer.shadowRadius = 10
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ selectedIcons.append("ic_settings_filled")

Now initialize the controller object through the following method:
```swift
tabController = AZTabBarController.insert(into: self, withTabIconNames: icons, andSelectedIconNames: selectedIcons)
tabController = .insert(into: self, withTabIconNames: icons, andSelectedIconNames: selectedIcons)
```

Add controllers:
Expand Down
3 changes: 3 additions & 0 deletions Sources/AZTabBarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ extension AZTabBarButton {
private func customizeAsHighlighted(image: UIImage,selectedColor: UIColor,highlightedColor: UIColor,ignoreColor: Bool = false) {
// We want the image to be always white in highlighted state.
self.tintColor = highlightedColor
self.setTitleColor(highlightedColor, for: [.highlighted])
self.setTitleColor(highlightedColor, for: [.highlighted,.selected])
self.setTitleColor(highlightedColor, for: [])
self.setImage(ignoreColor ? image : image.withRenderingMode(.alwaysTemplate), for: .normal)
// And its background color should always be the selected color.
self.backgroundColor = selectedColor
Expand Down
Loading

0 comments on commit c5f7484

Please sign in to comment.