我是新手,所以要花点时间来弄清楚发生了什么。这是我的代码片段。我还附有图片,显示单击按钮后的外观。任何帮助将不胜感激。谢谢。
@IBOutlet weak var btnOptionOne: UIButton!
@IBOutlet weak var btnOptionTwo: UIButton!
@IBOutlet weak var btnOptionThree: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
backgroundColor = view.backgroundColor
// Do any additional setup after loading the view, typically from a nib.
card.layer.cornerRadius = 20.0
frontLabel.layer.cornerRadius = 20.0
backLabel.layer.cornerRadius = 20.0
btnOptionOne.layer.cornerRadius = 20.0
btnOptionOne.layer.borderColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
btnOptionOne.layer.borderWidth = 3.0
btnOptionTwo.layer.cornerRadius = 20.0
btnOptionTwo.layer.borderColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
btnOptionTwo.layer.borderWidth = 3.0
btnOptionThree.layer.cornerRadius = 20.0
btnOptionThree.layer.borderColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
btnOptionThree.layer.borderWidth = 3.0
card.layer.shadowRadius = 15.0
frontLabel.layer.shadowRadius = 15.0
backLabel.layer.shadowRadius = 15.0
card.layer.shadowOpacity = 0.2
frontLabel.layer.shadowOpacity = 0.2
backLabel.layer.shadowOpacity = 0.2
frontLabel.clipsToBounds = true
backLabel.clipsToBounds = true
}
@IBAction func didTapOnFlashcard(_ sender: Any) {
if frontLabel.isHidden == true{
frontLabel.isHidden = false;
}
else{
frontLabel.isHidden = true;
}
}
@IBAction func didTapOptionOne(_ sender: Any) {
btnOptionOne.isHidden = true
}
答案 0 :(得分:1)
在单击时删除阴影:-
btnOptionOne.layer.shadowOpacity = 0
btnOptionOne.layer.shadowRadius = 0
btnOptionOne.layer.shadowColor = nil