Giter Club home page Giter Club logo

batabbarcontroller's Introduction

BATabBarController

CI Status Version License Platform Carthage compatible

Overview

Recent Versions

Language Version
Swift 5 2.0.1
Swift 4 1.0.1
Obj C 0.1.6

The standard TabBarController is very limited in terms of animations when you make a selection. This cocoapod allows you to use one with a sleek animation with customizable properties!

For a how-to guide on use go to: https://antiguab.github.io/batabbarcontroller/

batabbarcontroller's People

Contributors

antiguab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

batabbarcontroller's Issues

Memory issues

Hey! I just wanted to know why does this loads every view all at once not only after tab click? It causes so much lag. I am pretty sure, this is library's fault. I am using it with Swift like this:

var tabBar: BATabBarController!
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    let tabBarItem1: BATabBarItem = {
        let tabBarItem = BATabBarItem(image: UIImage(named: "Tab")?.withRenderingMode(.alwaysTemplate), selectedImage: UIImage(named: "Tab"))
        tabBarItem?.tintColor = MainColors.mainLighterGray
        return tabBarItem!
    }()
    
    let tabBarItem2: BATabBarItem = {
        let tabBarItem = BATabBarItem(image: UIImage(named: "Tab")?.withRenderingMode(.alwaysTemplate), selectedImage: UIImage(named: "Tab"))
        tabBarItem?.tintColor = MainColors.mainLighterGray
        
        return tabBarItem!
    }()
    let tabBarItem3: BATabBarItem = {
        let tabBarItem = BATabBarItem(image: UIImage(named: "Tab")?.withRenderingMode(.alwaysTemplate), selectedImage: UIImage(named: "Tab"))
        tabBarItem?.tintColor = MainColors.mainLighterGray
        return tabBarItem!
    }()
    
    override func viewDidLayoutSubviews() {
        
        var vc1: UIViewController!
        var vc2: UIViewController!
        var vc3: UIViewController!
        
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        
        vc1 = storyboard.instantiateViewController(withIdentifier: "Tab1")
        vc2 = storyboard.instantiateViewController(withIdentifier: "Tab2")
        vc3 = storyboard.instantiateViewController(withIdentifier: "Tab3")
        
        self.tabBar = BATabBarController()
        self.tabBar.tabBarItemStrokeColor = UIColor("#3F72AF")
        self.tabBar.viewControllers = [vc1, vc2, vc3]
        self.tabBar.tabBarItems = [tabBarItem1, tabBarItem2, tabBarItem3]
        self.tabBar.setSelectedView(vc1, animated: false)
        
        self.tabBar.tabBarBackgroundColor = MainColors.mainDarkerGray
        self.tabBar.delegate = self
        self.view.addSubview(self.tabBar.view)
        
    }
    
    func tabBarController(_ tabBarController: BATabBarController!, didSelect viewController: UIViewController!) {
        print(viewController)
    }

How to select tab item programmatically ?

Thanks for your great open source.

I tried to use this method to select other tab programmatically.

[self.vc.tabBar selectedTabItem:1 animated:YES];

It works. But the selected image of previous tab still remains.

multiple tab bar click

If we press more than 1 tab at once, animated circle is drawn on all the selected tabs at once.

Circle is too big on first load

Hi mate, see what happens when I present my BaTabBarController - the circle of the selected item is too big:

IMG_3764

Device is iPhone X (iOS 13.1.2)

Swift 5.0 support

Thanks for the amazing pod. If possible can you release 5.0swift version.

Xamarin.iOS BATabBarController

Hello !

First of all, I know this is not an issue.

It would be great to have this package on nugget in C# .

Is there any intention to release a version for users of xamarin.ios??

Thank you!

Swift Support!

Could you please add swift support to this? Or create a Swift branch? Thanks!

Please help. How can I switch between vc

import UIKit
import BATabBarController

class MainViewController: UIViewController, BATabBarControllerDelegate {

override func viewDidLoad() {
    super.viewDidLoad()
    
    let vc1 = UIViewController()
    let vc2 = UIViewController()
    let vc3 = UIViewController()
    
    let tabBarItem  = BATabBarItem(image: UIImage(named: "intro1")!, selectedImage: UIImage(named: "intro1")!)
    let tabBarItem2 = BATabBarItem(image: UIImage(named: "intro4")!, selectedImage: UIImage(named: "intro4")!)
    let tabBarItem3 = BATabBarItem(image: UIImage(named: "intro5")!, selectedImage: UIImage(named: "intro5")!)
    
    
    let baTabBarController = BATabBarController()
    baTabBarController.viewControllers = [vc1, vc2, vc3]
    baTabBarController.tabBarItems = [tabBarItem, tabBarItem2, tabBarItem3]
    baTabBarController.delegate = self
    self.view.addSubview(baTabBarController.view)
    print("fvsfd")
    
    
    
}

func tabBarController(_ tabBarController: BATabBarController, didSelect: UIViewController) {
    
   
    
}

}

xcode8 or ios10 bug??

Thanks to open source, I use it in the project to achieve the very good-looking animation, but recently the package out of the question, when the xcode 8.2, when the scheme is set to release, all is lost, but set the debug mode, the performance is normal. You can repeat this disaster, I hope you can check it, I also check tomorrow
screenshot

how to use hidesBottomBarWhenPushed

hidesBottomBarWhenPushed is a property of a UIViewController how to use with BATabBarController

for example :


 override func viewDidLayoutSubviews() {
       
        
        if(self.firstTime){
                        
            var libraryTabBarItem : BATabBarItem!
            var createTabBarItem : BATabBarItem!
            var getInspiredTabBarItem : BATabBarItem!
            var activitiesTabBarItem : BATabBarItem!
            var myProfileTabBarItem : BATabBarItem!
            
            let storyboard = UIStoryboard(name: "Main", bundle: nil)
            // LIBRARY
            let LibraryNC = storyboard.instantiateViewController(withIdentifier: "libraryNavigationController") as! UINavigationController
            // CREATE
            let CreateNC = storyboard.instantiateViewController(withIdentifier: "createNavigationController") as! UINavigationController           
            // GET INSPIRED
            let GetInspiredVC = storyboard.instantiateViewController(withIdentifier: "GetInspiredViewController") as! GetInspiredViewController
            // ACTIVITIES
            let ActivitiesVC = storyboard.instantiateViewController(withIdentifier: "ActivitiesViewController") as! ActivitiesViewController
            // MY PROFILE
            let MyProfileVC = storyboard.instantiateViewController(withIdentifier: "MyProfileViewController") as! MyProfileViewController
            
            
            var attrs = [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 11.0) , NSAttributedStringKey.foregroundColor : UIColor.white]
            
            
            let LibraryString = NSMutableAttributedString(string:"LIBRARY", attributes:attrs)
            let CreateString = NSMutableAttributedString(string:"CREATE", attributes:attrs)
            let GetInspiredString = NSMutableAttributedString(string:"GETINSPIRED", attributes:attrs)
            let ActivitiesString = NSMutableAttributedString(string:"ACTIVITIES", attributes:attrs)
            let MyProfileString = NSMutableAttributedString(string:"MYPROFILE", attributes:attrs)
            
            
            libraryTabBarItem = BATabBarItem(image: UIImage(named:"ic_photo_library_white_36pt"), selectedImage: UIImage(named:"ic_photo_library_white_36pt")?.maskWithColor(color: UIColor.red), title: LibraryString)
            createTabBarItem = BATabBarItem(image: UIImage(named:"ic_mode_edit_white_36pt"), selectedImage: UIImage(named:"ic_mode_edit_white_36pt")?.maskWithColor(color: UIColor.red), title: CreateString)
            getInspiredTabBarItem = BATabBarItem(image: UIImage(named:"ic_youtube_searched_for_white_36pt"), selectedImage: UIImage(named:"ic_youtube_searched_for_white_36pt")?.maskWithColor(color: UIColor.red), title: GetInspiredString)
            activitiesTabBarItem = BATabBarItem(image: UIImage(named:"ic_mail_white_36pt"), selectedImage: UIImage(named:"ic_mail_white_36pt")?.maskWithColor(color: UIColor.red), title: ActivitiesString)
            myProfileTabBarItem = BATabBarItem(image: UIImage(named:"ic_person_outline_white_36pt"), selectedImage: UIImage(named:"ic_person_outline_white_36pt")?.maskWithColor(color: UIColor.red), title: MyProfileString)
            
            baTabController = BATabBarController()
            baTabController.viewControllers = [LibraryNC,CreateNC,GetInspiredVC,ActivitiesVC,MyProfileVC]
            baTabController.tabBarItems = [libraryTabBarItem,createTabBarItem,getInspiredTabBarItem,activitiesTabBarItem,myProfileTabBarItem]
            
            
            self.baTabController.delegate = self;
           // self.baTabController.hidesBottomBarWhenPushed = true
            self.view.addSubview(self.baTabController.view)
            self.firstTime = false;
}

now
if LibraryNC or CreateNC pushes a viewController i want the tabs to be hidden

thanks in advance

iOS 8.0 support

Currently, BATabBarController is targeting only iOS8.1+, is there any reason to not support iOS8.0?

Pixelated icon

Hello, I have a problem with the TabBar,
The display of icons is pixelated, I use the size of 25 * 25 for the normal display, 50 * 50 for @ 2x and 75 * 75 for @ 3x, before that I used the size 64 * 64, 128 * 128 and 256 * 256 but the result was not good.
Do you have any suggestions for me?

Thanks for your help :)
@antiguab

Push to tabbar controller

Simulator Screen Shot - iPhone XR - 2019-11-13 at 12 34 24

Hello Bryan antiguab,

whenever I load tabbar without push its work fine but whenever I Push to this tabbar controller this issue happned
I checked and apply all properties but not working

can you please check?

Thank you

Hide/Unhide

Hi, how can I hide and unhide the tabbar ?

Sincerely

Value of type 'BATabBarController' has no member 'tabBarItems'

Hey,

I'm trying to use BATabBarController but I actually have an issue with it following the guide.
My error is :

Value of type 'BATabBarController' has no member 'tabBarItems'

class BATabBarController: UITabBarController, UITabBarControllerDelegate {
    override func viewDidLoad() {
        super.viewDidLoad()
         let testController = BATabBarController()
        var tabBarItem, tabBarItem2, tabBarItem3: BATabBarItem
        
        
        let vc1 = UIViewController()
        let vc2 = UIViewController()
        let vc3 = UIViewController()
        
        let option1 = NSMutableAttributedString(string: "Feed")
        option1.addAttribute(.foregroundColor, value: UIColor.white, range: NSRange(location: 0, length: option1.length))
        tabBarItem  = BATabBarItem(image: UIImage(named: "icon1_unselected")!, selectedImage: UIImage(named: "icon1_selected")!, title: option1)
        tabBarItem2 = BATabBarItem(image: UIImage(named: "icon2_unselected")!, selectedImage: UIImage(named: "icon2_selected")!, title: option1)
        tabBarItem3 = BATabBarItem(image: UIImage(named: "icon3_unselected")!, selectedImage: UIImage(named: "icon3_selected")!, title: option1)
        
        let badge = BATabBarBadge(value:20, badgeColor: .red)
               tabBarItem2.badge = badge
        
        testController.delegate = self
        testController.viewControllers = [vc1, vc2, vc3]
        testController.tabBarItems = [tabBarItem,tabBarItem2,tabBarItem3]
        self.view.addSubview(testController.view)
    }

Here is my code.

Tabbar icons pixelated

I'm using BATabBarController(Cocoa pod), everything works fine, but the tab icons are pixelated, tried variant size of icons still icons are pixelated especially in 5s,6,7&8, attached screenshots

img_5193

Update badge value

Hi,

i can't update badge value. I missed something ?
This is how I try to update the badge:

[[[tabBarController.tabBarItems objectAtIndex:2]badge]setBadgeValue:@8];

Thank you for your help !

Bar item image issue

ezgif-5-3c494cc3e9

It works not well, can you fix it, pls?
Need to hide selected image, when item not selected

subView can't center

Screen Shot 2019-09-09 at 3 46 28 PM

subView orange I set to center horizontal. but when build app the subview can't center

Vertical tabbar

Not sure if we can still call it a TabBar, but it would be awesome to have this feature. It could be useful for universal application:

  • Classic TabBar at the bottom on iPhone
  • Vertical TabBar (like a permanent menu) on iPad

The most of animated tabbar libraries are based on UITabBar which make that feature impossible, but for BATabBarController it looks possible since it's based on UIView... :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.