UITabBar在初始加载时没有显示

时间:2014-07-02 16:07:04

标签: ios ios7 swift

我的应用程序加载后,我的UITabBar实例化时遇到问题。在实例化我的viewControllers之后,我创建了一个UITabBarController的子类,我使用方法setViewControllers。在其中我设置自定义TabBarItems ..当加载应用程序时,我的TabBarMenu只是我定义的backgroundcolor,并且第一个项目被选中并显示黑色。当我单击TabBarItems时,我显示的自定义图像正在显示。点击它们后,我的所有栏都按预期工作。有没有人知道我做错了什么?

的AppDelegate

//Initialize the navagation controller and the bottom bar
var navigationController = UINavigationController()
var bottomBarController = bottomBar()

bottomBar

class bottomBar: UITabBarController, UITabBarDelegate {

    var buttons: AnyObject[]?

    override func viewDidLoad() {
        super.viewDidLoad()

        //Set the feedController tab, that will show the main feet tab
        var feed: feedController = feedController()

        //Set the inboxController tab, that will let the user sell items
        var inbox: inboxController = inboxController()

        //Set the sellController tab, that will let the user sell items
        var sell: sellController = sellController()

        //Set the profileController tab, that will show info about a user that is logged in
        var profile: profileController = profileController()

        //Set the profileController tab, that will show info about a user that is logged in
        var menu: menuController = menuController()

        //Set the bottomBarController, that will be used as the main navigation bar
        buttons = [feed, inbox, sell, profile, menu]

        self.setViewControllers(buttons, animated: true)

        self.tabBar.tintColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)
        self.tabBar.barTintColor = UIColor(red: 255, green: 255, blue: 255, alpha: 1)
    }
}

0 个答案:

没有答案