我使用ESTabBarController以编程方式自定义标签栏。我想通过使用此代码增加中间选项卡栏的图像大小,但不能正常工作。
v3.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -6, right: 0)
v3.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0)
这是app delegate中的代码:
v1.tabBarItem = ESTabBarItem.init(ExampleIrregularityBasicContentView(), title: "账本", image: UIImage(named: "tab-icon-1"), selectedImage: UIImage(named: "tab-icon-1a"))
v2.tabBarItem = ESTabBarItem.init(ExampleIrregularityBasicContentView(), title: "账户", image: UIImage(named: "tab-icon-2"), selectedImage: UIImage(named: "tab-icon-2a"))
v3.tabBarItem = ESTabBarItem.init(ExampleIrregularityBasicContentView(), title: nil, image: UIImage(named: "tab-icon-3"), selectedImage: UIImage(named: "tab-icon-3"))
v4.tabBarItem = ESTabBarItem.init(ExampleIrregularityBasicContentView(), title: "发现", image: UIImage(named: "tab-icon-4"), selectedImage: UIImage(named: "tab-icon-4a"))
v5.tabBarItem = ESTabBarItem.init(ExampleIrregularityBasicContentView(), title: "我的", image: UIImage(named: "tab-icon-5"), selectedImage: UIImage(named: "tab-icon-5a"))
(v1.tabBarItem as? ESTabBarItem)?.contentView?.renderingMode = .automatic
(v2.tabBarItem as? ESTabBarItem)?.contentView?.renderingMode = .automatic
(v3.tabBarItem as? ESTabBarItem)?.contentView?.renderingMode = .automatic
(v4.tabBarItem as? ESTabBarItem)?.contentView?.renderingMode = .automatic
(v5.tabBarItem as? ESTabBarItem)?.contentView?.renderingMode = .automatic
tabBarController.viewControllers = [v1, v2, v3, v4, v5]
这是刺激器截图,我想稍微增加中间(+)标签栏项目。