카테고리 없음

swift 제스처 기능 넣어보기

kingarthur 2024. 9. 11. 17:09

하다보면 버튼이 꼭 아니더라도 체스처를 통해 버튼처럼 기능을 넣어야 하는 상황이 생길수도 ~

 

그래서 만들어봤다. 

 

        let tapGestureForImage = UITapGestureRecognizer(target: self, action: #selector(showImageOptions))
        editProfileView.profileImageView.isUserInteractionEnabled = true
        editProfileView.profileImageView.addGestureRecognizer(tapGestureForImage)
        editProfileView.profileImageButton.addTarget(self, action: #selector(showImageOptions), for: .touchUpInside)

 

이렇게 하면 이미지뷰 터치하면 함수이 있는 기능들이 활성화된다 ~ 

 

앞으로도 잘 사용해보자