首页 > 解决方案 > iPhone X - 底栏高度

问题描述

底栏

当我在 iPhone 模拟器上测试时,我的应用程序的底部栏出现问题。“使用安全区域布局指南”选项已启用。底部栏的高度看起来不错,但是当我单击一个图标时,该选定图标的背景应该是全白色的,但情况并非如此。我正在使用标签栏控制器。

此外,我认为的文本和标签是像素化的。

我的这个自定义标签栏控制器的代码如下

   super.viewDidLoad()

    self.tabBar.barTintColor = UIColor(red:0/255, green: 209/255, blue: 204/255, alpha: 1)


    // set selected icon background color
    let numberOfItems = CGFloat(tabBar.items!.count)
    let tabBarItemSize = CGSize(width: tabBar.frame.width / numberOfItems, height: tabBar.frame.height)
    tabBar.selectionIndicatorImage = UIImage.imageWithColor(color: UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1), size: tabBarItemSize).resizableImage(withCapInsets: UIEdgeInsets.zero)

    // remove default border
    tabBar.frame.size.width = self.view.frame.width + 4
    tabBar.frame.origin.x = -2

    tabBar.tintColor = UIColor(red:65/255, green: 174/255, blue: 168/255, alpha: 1)

    tabBar.unselectedItemTintColor = UIColor.white

标签: iosswiftiphone-x

解决方案


推荐阅读