본문 바로가기
반응형

iOS5

[iOS] WkWebView에서 window.open / window.close 처리 WKWebView에서 window.open 또는 window.close 대해 처리할 경우가 생기는데 어떻게 처리를 해야 하는지 알아봅시다. 웹뷰에서 window.open을 호출할 때 WKUIDelegate에 있는 webView(_:createWebViewWith:for:windowFeatures:) 함수가 호출됩니다. 이 함수 안에서 새로운 창을 보여주는 화면(createWebView)을 만들어서 세팅을 해주면 새로운 창 화면이 보입니다. 웹뷰에서 window.close를 호출하면 webViewDidClose(_:) 함수가 호출되는데 이 함수에서 새로운 창을 없애는 처리를 하면 됩니다. class ViewController: UIViewController { var createWebView: WKWebV.. 2022. 6. 30.
[iOS] 그림 그리기 오늘은 그림 그리기에 대해서 알아보겠습니다. 먼저 그림을 그리기 위해 UIImageView를 추가합니다. @IBOutlet weak var imgView: UIImageView! 직전에 터치하거나 이동한 위치(lastPoint), 선의 두께(lineSize), 선의 색상(lineColor)을 구성하는 변수를 선언합니다. var lastPoint: CGPoint! var linsSize: CGFloat = 5.0 var lineColor = UIColor.label.cgColor 터치 이벤트를 하기전에 실행할 내용을 touchesBegan 메소드에서 구현합니다. override func touchesBegan(_ touches: Set, with event: UIEvent?) { // 현재 발생한 터치 이.. 2022. 4. 12.
[iOS] 음성 녹음 오늘은 아이폰 음성 녹음에 대해서 알아보겠습니다. 먼저 info에 음성 permission 작업을 해줍니다. AVAudioRecorder 인스턴스 변수와 녹음 파일 변수를 생성해줍니다. var audioRecoder : AVAudioRecorder! lazy var recordURL: URL = { var documentsURL: URL = { let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) return paths.first! }() let fileName = UUID().uuidString + ".m4a" let url = documentsURL.appendingPathComponent(fileName).. 2022. 3. 14.
[iOS] 전화걸기 iOS에서 디바이스 전화걸기 하는 방법에 대하여 알아보겠습니다. let phoneNum = "010-1234-5678" if let phoneCallURL = URL(string: "tel://\(phoneNum)") { if UIApplication.shared.canOpenURL(phoneCallURL) { UIApplication.shared.open(phoneCallURL, options: [:], completionHandler: nil) } } 결과 화면 2022. 2. 28.
반응형