1
バッハ.playground
ファイルに表示されるが、灰色です。異なるResult Display Modes
をトグルすると助けになりませんでした。A UIImageグレースイフト3遊び場URLSession非同期
import UIKit
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
URLCache.shared = URLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)
var theImage = UIImageView()
let urlNew = NSURL(string: "https://upload.wikimedia.org/wikipedia/commons/6/6a/Johann_Sebastian_Bach.jpg")
let task = URLSession.shared.dataTask(with: urlNew! as URL) { (data, response, error) -> Void in
if error != nil {
print("thers an error in the log")
} else {
DispatchQueue.main.async() {
let image = UIImage(data: data!)
theImage.image = image
}
}
}
task.resume()
スウィフト3.0でバッハや.playground
内の任意UIImageView
をレンダリングするための最良の方法は何ですか?
これまでに何を試しましたか?それは明らかに適切な画像をダウンロードしているだけで、単に遊び場のUIバグかもしれません。また、 'UIImageView'をスキップし、' UIImage'を直接表示することができます。 –
私は試しました。 'UIImageView'から' UIImage'にコードを更新しても、グレーの影には何の影響もありません。 – Eric
私は今、自分のコンピュータの前にいませんが、今晩後に問題を再現しようとします。 –