Skip to content

Commit

Permalink
fixed manual selection crash,
Browse files Browse the repository at this point in the history
using tint and barTint color from existing tabbar
  • Loading branch information
askopin committed Feb 22, 2019
1 parent 9d08bfc commit 521d72f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CBFlashyTabBarController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'CBFlashyTabBarController'
s.version = '0.8.1'
s.version = '0.8.2'
s.summary = 'One another nice animated tabbar'
s.homepage = 'https://github.com/Cuberto/flashy-tabbar'
s.license = 'MIT'
Expand Down
11 changes: 0 additions & 11 deletions CBFlashyTabBarController/Classes/CBFlashyTabBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ open class CBFlashyTabBar: UITabBar {
fileprivate var shouldSelectOnTabBar = true
open override var selectedItem: UITabBarItem? {
willSet {
guard shouldSelectOnTabBar else {
shouldSelectOnTabBar = true
return

}
guard let newValue = newValue else {
buttons.forEach { $0.setSelected(false, animated: false) }
return
Expand Down Expand Up @@ -59,7 +54,6 @@ open class CBFlashyTabBar: UITabBar {
backgroundColor = UIColor.white
isTranslucent = false
barTintColor = UIColor.white
tintColor = #colorLiteral(red: 0.1176470588, green: 0.1176470588, blue: 0.431372549, alpha: 1)
}

open override var items: [UITabBarItem]? {
Expand Down Expand Up @@ -141,11 +135,6 @@ open class CBFlashyTabBar: UITabBar {
button.setSelected(false, animated: false)
}
selectedbutton.setSelected(true, animated: false)
if let item = items?[index] {
shouldSelectOnTabBar = false
selectedItem = item
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ open class CBFlashyTabBarController: UITabBarController {

open override func viewDidLoad() {
super.viewDidLoad()
guard self.tabBar as? CBFlashyTabBar == nil else {
return
}
let tabBar = CBFlashyTabBar()
tabBar.barTintColor = self.tabBar.barTintColor
self.setValue(tabBar, forKey: "tabBar")
}

Expand Down
1 change: 1 addition & 0 deletions CBFlashyTabBarController/Classes/CBTabBarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class CBTabBarButton: UIControl {
guard animated, let deselectAnimation = deselectAnimation else {
tabLabel.isHidden = true
tabImage.isHidden = false
dotView.isHidden = true
return
}
tabImage.isHidden = false
Expand Down
2 changes: 1 addition & 1 deletion CBFlashyTabBarController/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.81</string>
<string>0.8.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
Expand Down
3 changes: 2 additions & 1 deletion Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import CBFlashyTabBarController

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -15,7 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

CBFlashyTabBar.appearance().tintColor = #colorLiteral(red: 0.1176470588, green: 0.1176470588, blue: 0.431372549, alpha: 1)
return true
}

Expand Down
2 changes: 1 addition & 1 deletion Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.81</string>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit 521d72f

Please sign in to comment.