티스토리 뷰

Programming/IOS

Swift 3.1

파란크리스마스 2017. 4. 26. 09:34
728x90

Swift 3.1

출처 : mozilla-mobile/firefox-ios
아이폰 Swift 개발 #6 Web Browser App - Machine Learning and ...
[iOS] WebKit API 알아보기. : 네이버 블로그

세로모드 고정

출처 : Swift 3 how to lock orientation - Stack Overflow

override var shouldAutorotate: Bool {
    return false
}

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.portrait
}

 override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
    return UIInterfaceOrientation.portrait
}

override func viewDidLoad() {
    super.viewDidLoad()
}

URL 주소의 이미지 가져오기

출처 : swift3 - Swift 3: Display Image from URL - Stack Overflow

                let url = URL(string: hostUrl + (share_url as! String))
                NSLog("url = \(url?.absoluteString)")

                var data = NSData(contentsOf: url as! URL)
                var image = UIImage(data : data as! Data)

문자열 내장 합수

출처 : How does String.Index work in Swift 3
Index of a substring in a string with Swift

JavaScript(Alert,Confirm,Prompt)

출처 : WKWebViewでJavaScript(Alert,Confirm,Prompt)の処理
WKWebView 사용 시 필수적으로 넣어줘야 하는Delegate 넷.

오류 해결 / This application is modifying the autolayout engine from a background thread, which can lead to engine corruption

출처 : This application is modifying the autolayout engine from a background thread, which can lead to engine corruption - Stack Overflow

    func alert(message : String) {
        let alertView = UIAlertController(title: "파란크리스마스", message: message, preferredStyle: .alert)
        alertView.addAction(UIAlertAction(title: "확인", style: .default, handler: { (alertAction) -> Void in
            //logUserIn()
        }))
        //alertView.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
        DispatchQueue.main.async {
            self.present(alertView, animated: true, completion: nil)
        }
    }

배포

출처 : 내가 만든 iOS앱을 앱스토어에 배포해보자 - xCode로 소스 업로드하기 ...

댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함