메모앱 저장 기능 구현(ios, swift, xcode)


메모앱 저장 기능 구현(ios, swift, xcode)

입력된 메모를 저장하고 내용이 없으면 경고를 해주는 기능을 구현한다. 저장 버튼을 컨트롤 눌러 드래그하여 뷰 컨트롤러에 Action으로 추가한다. 해당 함수에 기능을 추가할 것이다. 그리고 메모 자체의 내용을 가져와야 하므로 마찬가지로 컨트롤을 누르고 드래그해준다. 이것은 Outlet으로 설정해야 한다. 코드는 아래와 같다. import UIKit class ComposeViewController: UIViewController { @IBAction func close(_ sender: Any) { dismiss(animated: true, completion: nil) } @IBOutlet weak var memoTextView: UITextView! @IBAction func save(_ sender: Any) { guard let memo = memoTextView.text, memo.count > 0 else { alert(message: "메모를 입력하세요") return ...


#ios #siwft #UIAlertController #경고 #저장

원문링크 : 메모앱 저장 기능 구현(ios, swift, xcode)