【发布时间】:2016-06-13 11:18:40
【问题描述】:
我在UITabBarController 中制作中心圆UIButton。我只需要在 UIButton 从 tabBar 边框出来的地方绘制边框颜色。我怎样才能做到?我们只需要那里的边框颜色https://monosnap.com/file/7MDqGzpUdIbClvnAvAiY2kJYKUro7z
我把 UIButton 做成了
private func setupLifelineButton() {
let lifelineButton = UIButton(frame: CGRect(x: 0, y: 0, width: 64, height: 64))
var lifelineButtonFrame = lifelineButton.frame
lifelineButtonFrame.origin.y = view.bounds.height - lifelineButtonFrame.height - 13 // default without 13
lifelineButtonFrame.origin.x = view.bounds.width / 2 - lifelineButtonFrame.size.width / 2
lifelineButton.frame = lifelineButtonFrame
// lifelineButton.backgroundColor = .redColor()
lifelineButton.layer.cornerRadius = lifelineButtonFrame.height / 2
lifelineButton.layer.borderWidth = 0.5
lifelineButton.layer.borderColor = ColorManager.tabBarLayerColor.CGColor//UIColor.blackColor().CGColor
lifelineButton.addTarget(self, action: #selector(menuButtonAction), forControlEvents: .TouchUpInside)
// icon
// lifelineButton.setImage(UIImage(named: "LifeLineBarButtonIcon"), forState: .Normal)
self.view.addSubview(lifelineButton)
self.view.layoutIfNeeded()
}
更新:我需要删除边框颜色的下半部分
【问题讨论】:
标签: ios swift colors uitabbarcontroller border-color