
IOS에서 이미지뷰를 클릭 했을 때 이벤트 처리 방법입니다.
setting이라는 이미지를 만들어서 클릭을 해주는 것을 처리하면 아래와 같이 해주면 됩니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let settingTap = UITapGestureRecognizer(target: self, action: #selector(settingTapped)) | |
setting.isUserInteractionEnabled = true | |
setting.addGestureRecognizer(settingTap) | |
@objc func settingTapped() { | |
print("클릭입니다.") | |
} |
'IOS(Swift)' 카테고리의 다른 글
IOS Webview (0) | 2021.01.19 |
---|---|
Swift CollectionView (0) | 2021.01.03 |
IOS Admob달기 (0) | 2021.01.01 |
IOS Alert Example (0) | 2021.01.01 |
IOS Firestore (0) | 2020.12.30 |