【问题标题】:UITabBarController icons changing height on touchUITabBarController 图标在触摸时改变高度
【发布时间】:2017-07-20 13:33:11
【问题描述】:

我对@9​​87654325@ 有疑问,如果我将手指放在图标上并向上或向下拖动,图标会改变大小,我的拖动操作会使它们失去高度,我该如何阻止?

这是我的代码:

override func viewWillAppear(_ animated: Bool) {
   .................

    vc_friends.tabBarItem.imageInsets   = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
    vc_topCharts.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
    vc_newsfeed.tabBarItem.imageInsets  = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
    vc_myProfile.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
    vc_pools.tabBarItem.imageInsets     = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)

    self.viewControllers = [vc_friends,vc_topCharts,vc_newsfeed,vc_pools,vc_myProfile]

    self.selectedIndex = 2
}

看起来是这样的:

...如果我单击它并将手指放在它上面并向上或向下移动手指:

【问题讨论】:

    标签: ios uitabbar uitabbaritem uiedgeinsets


    【解决方案1】:

    当您的负值与另一个方向的正值不相反时,这是一个已知问题。将您的插图更改为:

    UIEdgeInsets(top: 6, left: 0, bottom: -6, right: 0)
    

    【讨论】:

      猜你喜欢
      • 2022-06-25
      • 2020-02-20
      • 2011-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多