CosmicMind / Material

A UI/UX framework for creating beautiful applications.
http://cosmicmind.com
MIT License
12k stars 1.26k forks source link

I can't find a way to make the TabBar item title to position below the image. #983

Closed jojonarte closed 6 years ago

jojonarte commented 6 years ago

I've been trying to find a way to position the title of the tabbar below the icon vertically. Is there no exposed property that does this?

daniel-jonathan commented 6 years ago

You need to use a BottomNavigationController to do that. If you need any further help, please reopen this issue. Thank you!

jojonarte commented 6 years ago

What property in BottomNavigationController should I use by default I'm getting the same horizontal aligned behavior. I can't reopen btw. This is how the tabItems looks like image

jojonarte commented 6 years ago

I couldn't find a way to make it look as the guidelines https://material.io/guidelines/components/bottom-navigation.html#

daniel-jonathan commented 6 years ago

Use the BottomNavigationController as a base and here is some sample code that achieves what you are looking for:

import UIKit
import Material

class PhotoViewController: UIViewController {
    convenience init() {
        self.init(nibName: nil, bundle: nil)
        prepareTabBarItem()
    }

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

extension PhotoViewController {
    fileprivate func prepareTabBarItem() {
        tabBarItem.image = Icon.cm.photoCamera?.tint(with: Color.blueGrey.base)
        tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: Color.blue.base)
        tabBarItem.title = "Photos"
    }
}
screen shot 2017-12-04 at 3 29 33 pm
jojonarte commented 6 years ago

Still the same on an iPad though.

daniel-jonathan commented 6 years ago

I need to see an image or get a sample project to investigate. Please send one my way :) Thank you!