Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 我可以在Sotabar库的按钮下设置文本吗?_Swift_Uitabbar_Swift5 - Fatal编程技术网

Swift 我可以在Sotabar库的按钮下设置文本吗?

Swift 我可以在Sotabar库的按钮下设置文本吗?,swift,uitabbar,swift5,Swift,Uitabbar,Swift5,我使用SOTabBar库,在文档中没有提到任何关于标签下文本的内容。是否有人使用它并且在它下面设置了一些文本 在带有UILabels和set text的选项卡按钮下添加一些视图是否是一种解决方案?这并不是对所有设备都有响应…一个好的起点始终是存储库中的示例。在不了解当前方法的情况下,您可以尝试类似的方法 class ViewController: SOTabBarController { override func loadView() { super.loadView

我使用SOTabBar库,在文档中没有提到任何关于标签下文本的内容。是否有人使用它并且在它下面设置了一些文本


在带有UILabels和set text的选项卡按钮下添加一些视图是否是一种解决方案?这并不是对所有设备都有响应…

一个好的起点始终是存储库中的示例。在不了解当前方法的情况下,您可以尝试类似的方法

class ViewController: SOTabBarController {

    override func loadView() {
        super.loadView()
        SOTabBarSetting.tabBarTintColor = #colorLiteral(red: 2.248547389e-05, green: 0.7047000527, blue: 0.6947537661, alpha: 1)
        SOTabBarSetting.tabBarCircleSize = CGSize(width: 60, height: 60)
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        self.delegate = self
        let homeStoryboard = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "HOME_ID")
        let chatStoryboard = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "CHAT_ID")
        let sleepStoryboard = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SLEEP_ID")
        let musicStoryboard = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MUSIC_ID")
        let meStoryboard = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ME_ID")

        homeStoryboard.tabBarItem = UITabBarItem(title: "Home", image: UIImage(named: "home"), selectedImage: UIImage(named: "home_Selected"))
        chatStoryboard.tabBarItem = UITabBarItem(title: "Chat", image: UIImage(named: "chat"), selectedImage: UIImage(named: "chat_Selected"))
        sleepStoryboard.tabBarItem = UITabBarItem(title: "Sleep", image: UIImage(named: "moon"), selectedImage: UIImage(named: "moon_Selected"))
        musicStoryboard.tabBarItem = UITabBarItem(title: "Music", image: UIImage(named: "music"), selectedImage: UIImage(named: "music_Selected"))
        meStoryboard.tabBarItem = UITabBarItem(title: "Me", image: UIImage(named: "menu"), selectedImage: UIImage(named: "menu_Selected"))

        viewControllers = [homeStoryboard, chatStoryboard,sleepStoryboard,musicStoryboard,meStoryboard]
    }

}
如果需要,您可以通过
viewController.tabBarItem.title


链接到

感谢您的评论@Harry J,我能更好地理解文档,我能解决我的问题。