到目前为止,边框在触摸时闪烁以匹配文本,但按下后边框不会恢复为白色。我不知道如何在按下时使边框闪烁(在@IBAction函数中启动)我相信它与按钮的触摸有关Up Inside发送的活动。
@IBAction func buttonSearchAction(sender: AnyObject) {
let myColor : UIColor = UIColor(red: (255/255.0), green: (255/255.0), blue: (255/255.0), alpha: 0.5)
buttonSearch.layer.borderColor = myColor.CGColor
}
答案 0 :(得分:0)
:hi Identifier
Identifier xxx term=underline ctermfg=208 guifg=#FD971F
答案 1 :(得分:0)
与Swift中的上述解决方案相同:
myButton.addTarget(self, action: "unhighlightBorder", forControlEvents: UIControlEvents.TouchDown);
myButton.addTarget(self, action: "highlightBorder", forControlEvents: UIControlEvents.TouchUpInside);
func unhighlightBorder(){
myButton.layer.borderColor = UIColor.greenColor().CGColor;
}
func highlightBorder(){
myButton.layer.borderColor = UIColor.blueColor().CGColor;
}