www.codegrepper.com/code-examples/swift/change+opacity+of+button+clicked+swift
IBAction func keyPressed(_ sender: UIButton) {
sender.alpha = 0.5
//Code should execute after 0.2 second delay.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
//Bring's sender's opacity back up to fully opaque.
sender.alpha = 1.0
}
}
'개발 > 아이오에스' 카테고리의 다른 글
ios swift] 이전 뷰로 이동하기 (코드) (0) | 2021.01.18 |
---|---|
ios] xcode app 다크모드 적용 끄기 (0) | 2021.01.13 |
swfit] UIbutton의 타이틀값 얻기 sender.currentTitle (0) | 2020.12.30 |
swift] Photos 프레임워크 (0) | 2020.12.28 |
swift ] 다음 화면으로 데이터 전달하기 (0) | 2020.12.26 |