我在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()
}
我需要删除边框颜色的下半部分
3条答案
按热度按时间sczxawaw1#
这可能对你有帮助
这是输出
wtlkbnrh2#
你可以制作一个你想要的图像,然后给予按钮一个图像!😐
taor4pac3#
我做的不一样
我的结果