当前位置:网站首页>Detect when a tab bar item is pressed

Detect when a tab bar item is pressed

2022-07-07 04:34:00 Zafo

problem :

I have a root view controller which isn't set as the custom class for any of my view controllers on my storyboard. I have a root view controller , It is not set as a custom class for any view controller on my storyboard .Instead, all of my view controllers are subclassing this class like so. contrary , All my view controllers class this class like this .

// RootViewControllerclass RootViewController: UIViewController, UITabBarDelegate {     // This is not getting executed on any of the view controllers    func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {        print("ddd")    }}// Subclassing it class TopStoriesViewController: RootViewController {}

But I seem to be struggling with doing something when a tabbaritem is pressed on the view controller which is subclassing the rootviewcontroller, ie, the message is not being printed. however , When inheriting rootviewcontroller Press tabbaritem when , I seem to be trying to do something , That is, no message is printed .


Solution :

Reference resources : https://stackoom.com/en/question/2Hyfj
原网站

版权声明
本文为[Zafo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130758038120.html

随机推荐