我收到错误消息
无法转换类型的值(NSURLRequest!,NSHTTPURLResponse!,UIImage!) - >虚空'预期参数类型'((NSURLRequest,NSHTTPURLResponse?,UIImage) - > Void)?
这是代码
import UIKit
class RoutineCell: UITableViewCell {
@IBOutlet weak var bannerImageView: UIImageView!
@IBOutlet weak var routineTitleLabel: UILabel!
@IBOutlet weak var shortDescriptionLabel: UILabel!
var routine: Routine! {
didSet {
routineTitleLabel.text = routine.title
shortDescriptionLabel.text = routine.shortDescription
bannerImageView.setImageWithURL(NSURL(string: routine.bannerImageUrl)!)
bannerImageView.setImageWithURLRequest(NSURLRequest(URL: NSURL(string: routine.bannerImageUrl)!), placeholderImage: nil, success: { (request: NSURLRequest!, response: NSHTTPURLResponse!, image: UIImage!) -> Void in
self.bannerImageView.alpha = 0.0
self.bannerImageView.image = image
UIView.animateWithDuration(0.2, animations: { () -> Void in
self.bannerImageView.alpha = 1.0
})
}, failure: nil)
}
}
override func awakeFromNib() {
self.selectionStyle = UITableViewCellSelectionStyle.None
super.awakeFromNib()
}
override func prepareForReuse() {
bannerImageView.image = nil
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
谢谢
答案 0 :(得分:1)
您对bannerImageView.setImageWithURLRequest
回调的声明错误
(request: NSURLRequest!, response: NSHTTPURLResponse!, image: UIImage!)
您需要使用以下
(request: NSURLRequest, response: NSHTTPURLResponse?, image: UIImage)