ChenYilong / CYLTabBarController

[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
MIT License
6.91k stars 1.45k forks source link

swift 中无法设置titlePositionAdjustment 没有开放set方法 #174

Closed buoge closed 7 years ago

buoge commented 7 years ago

Base Info for this issue

  1. Version:v1.13.1
  2. Language:Objective-C
  3. iOS System Version:iOS10
  4. Prototype(是否是真机):YES
  5. Issue Type:Enhancement

1. How to repeat the problem.

CYLTabBarController.h:swift 中无法设置这个值:titlePositionAdjustment,只有 get 方法: open var titlePositionAdjustment: UIOffset { get }, 这样子就无法设置按钮的左右间距? 是需要使用新的方式调整吗? self.tabBarItem.titlePositionAdjustment = UIOffset(horizontal: 10, vertical: 10)

2. Please help me in this way.

3. Here is a Demo.

4. Here is my Debug log

buoge commented 7 years ago

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { // 自定义Tabbar间距 customizeTabbarStyle() }

// 自定义tabbar样式 func customizeTabbarStyle(){ let tabBarItemAppearance = UITabBarItem.appearance() tabBarItemAppearance.titlePositionAdjustment = UIOffset(horizontal: 5, vertical: 10) }

ChenYilong commented 7 years ago

ok