【发布时间】:2019-12-26 09:40:38
【问题描述】:
在我的应用程序中,我尝试将 UITabbar 背景图像设置为子视图,但是,背景图像在 UITabbar 中重复出现,下面是我在 UITabbar 中设置背景图像的代码
tabBar.backgroundImage = UIImage(named: "Pannel.png")
self.tabBar.isTranslucent = false
self.tabBar.autoresizesSubviews = false;
self.tabBar.clipsToBounds = true[![enter image description here][1]][1]
。这是我的标签栏图像输出
第二种方法
将视图添加为子视图
let bgView: UIImageView = UIImageView(image: UIImage(named: "Pannel.png"))
bgView.frame = CGRect(x: 0, y: self.tabBar.frame.origin.y - 35, width: self.tabBar.frame.width , height: 64)
self.view.addSubview(bgView)
下面是我的第二种方法的输出
【问题讨论】:
标签: ios swift uiimageview uitabbarcontroller uitabbar