yervandsar / ExpandedTabBar

ExpandedTabBar is a very creative designed solution for "more" items in UITabBarController. It's greate experience to have more comfortable and intuitive UI.
Other
308 stars 20 forks source link

ExpandedTabBarOptions not working #9

Closed iamdeadman closed 5 years ago

iamdeadman commented 5 years ago

Hi I am trying to set these following options in my controller and they don't do nothing.

var options = ExpandedTabBarOptions() options.containerItemsSpace = 5 options.spaceBetweenImageTitle = 5 options.containerBottomMargin = 5 options.backgroundColor = UIColor.black options.containerBackgroundColor = UIColor.black options.titleColor = UIColor.hexColor("#dab070") let fontDesc = UIFontDescriptor(name: "Snell Roundhand", size: 18) options.titleFont = UIFont(descriptor: fontDesc, size: fontDesc.pointSize) options.imageContentMode = .scaleAspectFit self.options = options

How can I make them work please suggest, or am I setting them incorrectly ?

yervandsar commented 5 years ago

Hi @iamdeadman ) At first imageContentMode is .scaleAspectFit as default, no necessary to write it again.

Have you created a custom UITabBarController and inherited from ExpandedTabBarController, then set the options in viewDidLoad? If yes could you please provide with demo project to test in my end.

Thanks

iamdeadman commented 5 years ago

Yes, I copied the code from this custom view controller sample - https://github.com/yervandsar/ExpandedTabBar/blob/4471a11cdead4aaebd885c5fcf72ee0c75c1f0e4/ExpandedTabBar/CustomViewController.swift

and I am setting up these options in viewDidLoad method itself like this -

class StudyZoneViewController: ExpandedTabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        expandedDelegate = self
        initOptions()
    }

    func initOptions() {
        var options = ExpandedTabBarOptions()
        options.containerItemsSpace = 5
        options.spaceBetweenImageTitle = 5
        options.containerBottomMargin = 5
        options.backgroundColor = UIColor.black
        options.containerBackgroundColor = UIColor.black
        options.titleColor = UIColor.hexColor("#dab070")
        self.options = options
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

extension StudyZoneViewController: ExpandedTabBarControllerDelegate {
    func expandedTabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController, withItem tabBarItem: UITabBarItem?) {
        // Do some logic here
    }
}

but it doesn't seem to work and style the tab bar accordingly

yervandsar commented 5 years ago

Is it possible to share your project or create an example project for review, your code is working in my end