SOTabBar icon indicating copy to clipboard operation
SOTabBar copied to clipboard

HOW TO NAVIGATE THE ANOTHER TABBAR ON BUTTON CLICK

Open Shubham0816 opened this issue 3 years ago • 2 comments

Shubham0816 avatar Dec 22 '20 05:12 Shubham0816

i'm trying to find it, but not get it... @Ahmadalsofi Please guide us if you have any idea about this...

MeetBudheliya avatar Sep 05 '22 10:09 MeetBudheliya

@Ahmadalsofi

I have solution for above issue, follow the steps.

Line No : 137 , Class SOTabBar

func didSelectTab(index: Int) {
        if index + 1 == selectedIndex {return}
        animateTitle(index: index)
 
        previousSelectedIndex = selectedIndex
        selectedIndex  = index + 1
        
        delegate?.tabBar(self, didSelectTabAt: index)
        animateCircle(with: circlePath)
        animateImage()
        
        guard let image = self.viewControllers[index].tabBarItem.selectedImage else {
            fatalError("You should insert selected image to all View Controllers")
        }
        self.tabSelectedImageView.image = image
    }

Step 2: class SOTabBarController, set below function at line no : 77

func preSelectedIndex(index: Int){
        self.tabBar.didSelectTab(index: index)
    }

Step 3: Call the function from your Tabbar class

class UTabbarVC: SOTabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.delegate = self
// your VC setup here
...
// set here you want to selected index
preSelectedIndex(index: 1)
      }
}

khushalhoch23 avatar Apr 08 '24 10:04 khushalhoch23