Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - How to use inheritance in custom cell?

I have 6 custom cells in tablview. All custom cell has 2 types data. First is label. And 2nd is different from each one. So, I want to use here inheritance. like this : Base custom cell class contains : label 1 ,and label 2. child custom cell class contains : label 1, label 2 and other components which are different from each other custom cell.

So, in short, I want to make labels in custom cell or without custom cell and inherit in all (6) custom cell. But I don't know how to do it. Any suggestion will be great . Thank in advance .

like image 202
Ravi Avatar asked Aug 19 '15 09:08

Ravi


1 Answers

Depending on how you created your cell (in interface builder or not) this should be easy. I would recommend creating your cell in code, and then inherit the cell (usually you would use UITableViewCell now create your base cell class and inherit new cells from your new custom cell i.e. MyCustomBaseTableViewCell).

like image 195
tafh Avatar answered Oct 11 '22 14:10

tafh