需要帮助,无法转换类型 '(NSURLRequest!, NSHTTPURLResponse!, UIImage!) 的值
Need help, Cannot convert value of type '(NSURLRequest!, NSHTTPURLResponse!, UIImage!)
我收到一条错误消息
Cannot convert value of type (NSURLRequest!, NSHTTPURLResponse!, UIImage!) -> Void' to expected argument type '((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
}
}
感谢
您对 bannerImageView.setImageWithURLRequest
回调的声明是错误的
(request: NSURLRequest!, response: NSHTTPURLResponse!, image: UIImage!)
您需要使用以下内容
(request: NSURLRequest, response: NSHTTPURLResponse?, image: UIImage)
我收到一条错误消息
Cannot convert value of type (NSURLRequest!, NSHTTPURLResponse!, UIImage!) -> Void' to expected argument type '((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
}
}
感谢
您对 bannerImageView.setImageWithURLRequest
回调的声明是错误的
(request: NSURLRequest!, response: NSHTTPURLResponse!, image: UIImage!)
您需要使用以下内容
(request: NSURLRequest, response: NSHTTPURLResponse?, image: UIImage)