air6199
air6199

Reputation: 423

Change the colour of tab bar icons and table background under the "More" tab?

I have around 7 tab bar items and hence have been given a 'more' tab bar item. All the other tab bar items are using the 'Original' mode instead of 'Template' but when i select the 'more' tab, the remaining icons are back to 'Template' until they're dragged to the tab bar after pressing edit. As well as this, my other views are tableviews with a coloured background, when i select the 'more' tab, the tableview presented has a white background. I managed to fix this for the tableview but the cells within are white, with the empty cells having the correct colour. Any idea how i'd fix these issues?

Upvotes: 1

Views: 380

Answers (2)

air6199
air6199

Reputation: 423

Managed to fix it with this:

class mainTabBarViewController: UITabBarController, UITabBarControllerDelegate {

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(true)
        self.moreNavigationController.topViewController.view.backgroundColor = UIColor(red: 25.0/255.0, green: 25.0/255.0, blue: 25.0/255.0, alpha: 1.0)

        var view = self.moreNavigationController.topViewController.view as UITableView

        for cell in view.visibleCells(){
            var tableCell = cell as UITableViewCell
            tableCell.backgroundColor = UIColor(red: 25.0/255.0, green: 25.0/255.0, blue: 25.0/255.0, alpha: 1.0)
            tableCell.textLabel?.textColor = UIColor.whiteColor()
        }

    }
}

Now I just need to find a way to change the background colour for the view when the user presses 'Edit'.

Upvotes: 1

user1681673
user1681673

Reputation: 368

Make the fifth item in your tab bar controller a custom table view and call it 'More' and handle the navigation yourself.

Upvotes: 1

Related Questions