-
iOS) navigationItem에 textField를 넣었을때 키보드 내리는 방법Programing Language/iOS(Swift) 2020. 5. 21. 01:02728x90반응형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
func textFieldDoneBtnMake(text_field : UITextField) {//텍스트 입력할시 키보드 위에 done 기능 구현 let ViewForDoneButtonOnKeyboard = UIToolbar() ViewForDoneButtonOnKeyboard.translatesAutoresizingMaskIntoConstraints = false ViewForDoneButtonOnKeyboard.sizeToFit() ViewForDoneButtonOnKeyboard.tintColor = .black let btnDoneOnKeyboard = UIBarButtonItem(title: "Done", style: .plain, target: self, action: #selector(self.doneBtnFromKeyboardClicked)) ViewForDoneButtonOnKeyboard.items = [btnDoneOnKeyboard] text_field.inputAccessoryView = ViewForDoneButtonOnKeyboard } @objc func doneBtnFromKeyboardClicked(sender: Any) {//키보드 위에 done을 클릭하면 화면이 내려간다. self.view.window?.endEditing(true) //self.view.endEditing(true) <- 일반적인 view에 textField를 addSubview했을때 사용 } 728x90반응형'Programing Language > iOS(Swift)' 카테고리의 다른 글
iOS) collectionview cell을 가운데에 위치 시키기 (0) 2020.05.22 iOS) collectionview가 reloadData 명령으로 인해 실행이 완료 되었을때 알아차리는 방법 (0) 2020.05.22 iOS) iOS에서 안드로이드의 sharedpreference(쉐어드프리퍼런스)와 같은 기능 (0) 2020.05.13 iOS) textField에서 최대 입력 가능 글자 조절하기 (0) 2020.05.01 Alamofire 분석 (0) 2020.04.30