여러 버튼 정리 didTouchUpInside로 관리
1661 단어 Swift
@IBAction func didTouchUpInside(_ sender: AnyObject) {
//textTarget.resignFirstResponder()
print("sender in")
switch sender.tag {
case 1:
print("button1")
//printerPicker!.showPicker()
case 2:
print("button2")
//langPicker!.showPicker()
case 3:
print("button3")
case 4:
print("button4")
default:
print("sender out")
break
}
}
다음과 같은 여러 버튼을 배치합니다. @IBAction
안에 case 문장으로 분기하는 예.

다음과 같이 드래그하여 끈다.

연결된 버튼의 tagID를 설정합니다.

didTouchUpInside가 Received Action에 추가되었는지 확인합니다.

Reference
이 문제에 관하여(여러 버튼 정리 didTouchUpInside로 관리), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/shinsakujazzbass/items/4adbe340387d01bc7ee2텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)