728x90 swift6 [swift] IOS SQLite 사용하기 별다른 설치 없이도 내부적으로 사용 가능 (외부 라이브러리 X) Import import SQLite3 Create DB func createDB(path:String) -> OpaquePointer? { var db : OpaquePointer? = nil do { let filePath = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false).appendingPathComponent(path) //db 연결, 이미 존재한다면 다시 생성하지 않고 넘어감 if sqlite3_open(filePath.path, &db) == SQLITE_OK { print("Suc.. 2023. 3. 3. [swift] Navigation 정리 Navigation Stack 👉 네비게이션 뷰 컨트롤러 관리 하는데 사용 배열 형식으로 되어있음 pushViewController, popViewController 존재 Navigation Bar Title - Navigation Item을 추가해줘야 함 (bar) button Item 바 숨기기 override func viewWillAppear(_ animated: Bool) { self.navigationController!.setNavigationBarHidden(true, animated: true) } Navigation 동작 1. View Controller instance 가져옴 guard let rvc = self.storyboard?.instantiateViewController(id.. 2023. 3. 3. [swift] AppDelegate 정리 AppDelegate의 역할 👉 AppDelegate는 App( Application )이 해야할 일을 대신 구현한다는 의미이다. 여기에서 App이 해야할 일이란, Background 진입, Foreground 진입, 외부에서의 요청 (apns) 등을 말한다. @UIApplicationMain 모든 iOS 앱들은 UIApplicationMain 함수를 실행한다. 이 때 생성되는 것 중 하나가 UIApplication 객체다. 앱은 UIApplication이라는 객체로 추상화 되어 Run Loop를 통해 프로그램 코드를 실행한다. 개발자들은 AppDelegate를 통해 UIApplication의 역할의 일부를 위임받아 UI를 그릴수 있다. 👉 이때 UIApplication이 위임받을 클래스를 구별하는 방법.. 2023. 3. 3. [swift] TextField 입력형식 제어 TextField 입력값 형식 제어 Capitalization 첫 글자 자동으로 대문자 처리하는 기능 tf.autocapitalizationType = UITextAutocapitalizationType.sentences Correction 이어질 문자열 추천 및 자동 변환 tf.autocorrectionType = UITextAutocorrectionType.yes Spell Checking tf.spellCheckingType = UITextSpellCheckingType.no Keyboard Type tf.keyboardType = .numberPad Appearance 키보드 색상 및 테마 tf.keyboradAppearance = UIKeyboardAppearence.dark Return Key.. 2023. 2. 27. [swift] Table View 다루기 1. list 생성 및 Data 추가 var list = [SulVO]() override func viewDidLoad() { var sul = SulVO() sul.name = "맥주" sul.price = 4000 self.list.append(sul) sul = SulVO() sul.name = "소주" sul.price = 4000 self.list.append(sul) } 2. list Data 출력 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // 출력할 목록 셀 개수 반환 return self.list.count } override func tableView(_ ta.. 2023. 2. 27. [swift] PickerView 사용하기 (select) IOS에서 제공하는 PickerView 를 보편적으로 많이들 사용한다. Picker View 사용 let picker = UIPickerView() /* Category picker View 시작 */ func numberOfComponents(in pickerView: UIPickerView) -> Int { //몇개씩 출력할 것인지 return 1 } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { return categoryList.count } func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponen.. 2021. 5. 2. 이전 1 다음 728x90