CosmicMind / Samples

Sample projects using Material, Graph, and Algorithm.
http://cosmicmind.com
BSD 3-Clause "New" or "Revised" License
402 stars 263 forks source link

icons on tabbarItem #36

Closed helderalvesoliveira closed 7 years ago

helderalvesoliveira commented 7 years ago

Hello everyone,

how can add icons on item tabs (pageTab...), and remove title text?

thanks very much.

daniel-jonathan commented 7 years ago

Hey :)

Have you seen the PageTabBarController sample project ?

In each view controller, you want to add at the initialization phase the PageTabBarItem setup.

import UIKit
import Material

class RedViewController: UIViewController {
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        preparePageTabBarItem()
    }

    init() {
        super.init(nibName: nil, bundle: nil)
        preparePageTabBarItem()
    }

    open override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = Color.red.base
    }
}

extension RedViewController {
    fileprivate func preparePageTabBarItem() {
        pageTabBarItem.title = "Red"
        pageTabBarItem.titleColor = Color.blueGrey.base
    }
}

If you have any further issues, please reopen or create a new issue :)