【发布时间】:2016-01-02 08:01:44
【问题描述】:
代码如下:
@IBAction func deleteMeme(sender: UIBarButtonItem) {
if let foundIndex = MemeRepository.sharedInstance.memes.indexOf(selectedMeme) {
//remove the item at the found index
MemeRepository.sharedInstance.memes.removeAtIndex(foundIndex)
navigationController?.popViewControllerAnimated(true)
错误发生在(selectedMeme) 的.indexOf 方法中。
无法将 Meme! 类型的值转换为预期的参数类型 @noescape (Meme) throws -> Bool
迷因!是我的应用程序的结构。我该如何解决这个问题?
struct Meme {
var topText : String!
var bottomText: String!
var image: UIImage!
var memedImage: UIImage!
init(topText: String, bottomText: String, image: UIImage, memedImage: UIImage) {
self.topText = topText
self.bottomText = bottomText
self.image = image
self.memedImage = memedImage
【问题讨论】: