简体   繁体   中英

IOS 8 crash wen using image at a custom UITableViewCell

I am using a custom UITableViewCell , which I did with the help of a xib file , when I put an Image in my xib file my app crashes , this is the cellForRowAtIndexPath method (the first few lines where the app crashes):

    var cell : RecipeTableViewCell? = self.tableView?.dequeueReusableCellWithIdentifier("RecipeCell") as? RecipeTableViewCell

    if(cell == nil)
    {
        self.tableView?.registerNib(UINib(nibName: "RecipeCell", bundle: nil), forCellReuseIdentifier: "RecipeCell")
        cell = self.tableView?.dequeueReusableCellWithIdentifier("RecipeCell") as? RecipeTableViewCell
    }

it crashes at this line :

self.tableView?.dequeueReusableCellWithIdentifier("RecipeCell") as? RecipeTableViewCell

and I get this message :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView _isResizable]: unrecognized selector sent to instance.

I know that there's no such method (isResizable) for UIImageView it's for UIImage , so what's the problem ???

当您使用UIImageView代替UIImage时,通常会发生此错误。例如,如果您在某些动画中使用图像视图而不是图像,请检入RecipeTableViewCell类并将UIImageViews更改为UIImages。

我通过删除xib文件并重新创建它来解决这个问题,这是由于不洁的xib文件,谢谢大家:D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM