1
我對Swift比較陌生,仍然在理解閉包的概念。 我已閱讀此文章(Anonymous closure can not be used inside a closure that has explicit arguments)。 但是,答案是將過濾器從()更改爲{},但我不知道如何將其實現到我的函數中。匿名閉包參數不能用在具有明確參數的閉包中
<<< ImageRow()
{
$0.tag = "Image"
$0.title = "Choose your profile pic"
if let tutorPic = currentuser!.objectForKey("ProfPhoto") as! PFFile!
{
tutorPic.getDataInBackgroundWithBlock({(imageData:NSData?,error:NSError?)->Void in
if(error == nil)
{
let image = UIImage(data: imageData!)
print("YOOWAHH")
print(image)
print("***********")
self.imagez = image
print(self.imagez)
$0.value = imagez
}
})
}
}
的錯誤是在線路$0.value = imagez
。
我從Parse下載了圖像數據,並希望將其設置爲我的窗體的默認值。但編譯器說我已經有明確的參數,所以它不知道如何引用窗體的參數。我該如何修復這個?