我在调用Swift项目的特定方法时遇到问题。这里的ObjC方法签名:Swift在调用中的额外参数
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;
我不能把这个工作作为XCode中不断告诉我“额外的参数‘placeholderImage’呼叫”
self.lastLookImageView.setImageWithURL(url,
placeholderImage: nil,
options: SDWebImageRefreshCached,
completed: {
(image, error, cacheType) -> Void in
image = image.blurredImageWithRadius(30, iterations: 2, tintColor: UIColor.clearColor())
}
)
的XCode甚至不认识的方法当我Cmd +点击它:“找不到符号”。
我怀疑它与块有什么关系,因为我可以调用同一类的其他方法,这几乎是相同的,但没有完成块。工作示例:
self.lastLookImageView.setImageWithURL(NSURL(string: self.lastLook!.image), placeholderImage: nil, options: SDWebImageRefreshCached)
为背景的缘故:我用我混的OBJ-C和斯威夫特的项目称为SDWebImage(https://github.com/rs/SDWebImage)的组件。类已经导入我的桥接,Header.h
'forState'参数在哪里,为什么有一个'完成的'参数卷到最后? – Abizern 2015-02-10 18:35:52
完成处理程序存在,它在H文件上(https://github.com/rs/SDWebImage/blob/master/SDWebImage/UIImageView%2BWebCache.h#L129) – FRAGA 2015-02-11 11:12:16
我编辑了问题以包含签名I正在谈论。对不起 – FRAGA 2015-02-11 11:14:00