Swift 3.1

Programming/IOS 2017.04.26 09:34 Posted by 파란크리스마스

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로 소스 업로드하기 ...

저작자 표시
신고
TAG


 

티스토리 툴바