Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error that UITableViewCell with IBOutlet named `imageView` conflicts with superclass IBOutlet

I have made a custom UITableViewCell in which I have added 2 labels and one UIImageView, each with IBOutlets.

IBOutlet weak var imageView: UIImageView!

I've given the UIImageView an IBOutlet named imageView, but after adding it I am getting error:

Getter for 'imageView' with Objective-C selector 'imageView' conflicts with getter for 'imageView' from superclass 'UITableViewCell' with the same Objective-C selector"

enter image description here

How can I fix this error? Is there any way to use an IBOutlet named imageView in a UITableViewCell subclass?

like image 277
Ronit Avatar asked Feb 01 '17 06:02

Ronit


2 Answers

You are getting this error since UITableViewCell has its own imageView property and you are making an outlet of name imageView which will conflict with its super class(UITableViewCell) property name(imageView) which is a getter method. So, you just need to change the name of the outlet.

like image 98
Priya Avatar answered Oct 04 '22 00:10

Priya


Change the name of the outlet as everyone is suggesting, as tableviewCell has its own imageView property, so when you are assigning another outlet with the name of imageView the getter methods are getting conflicted

like image 23
Saheb Roy Avatar answered Oct 03 '22 23:10

Saheb Roy