请注意:这是 iOS Swift 2.0
我已将 tabBarItem 添加到我的 UITabBarController。该图像故意大于 TabBar 本身的高度(按设计)。当它在手机上呈现时,tabBarItem 的图像中有一条黑线。
这是我用来生成 tabBarItem 的代码:
let checkInstoryboard = UIStoryboard(name: "CheckIn", bundle: nil)
let checkInViewController = checkInstoryboard.instantiateInitialViewController() as! UINavigationController
checkInViewController.tabBarItem.image = UIImage(named:"check_icon_unselected_vector")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
checkInViewController.tabBarItem.selectedImage = UIImage(named:"check_icon_selected_vector")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
这是一张显示黑线的图片:
I would like to remove the black line through the green icon
如何去除穿过绿色图标的黑线?
最佳答案
要移除 UITabBar
的顶部阴影,请在第一个 View Controller 上使用以下代码:
UITabBar.appearance().shadowImage = UIImage()
UITabBar.appearance().backgroundImage = UIImage()
请注意,此代码将删除屏幕边缘到边缘的阴影线。
关于swift - iOS Swift tabBarItem 与 tabBar 边框相交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33162162/