I used it in one of my applications where I had several cell views. I have a cell with a border and a cell that had additional buttons and a cell with a textured image. I also needed to change them with the click of a button
Here is the code I used
//CustomCell.h @interface CustomCell : UIView //CustomCell.m @implementation CustomCell - (void)drawRect:(CGRect)rect { //Draw the normal images on the cell } @end
And for a custom cell with a border
Now, in my opinion, the controller, I will do the following
CustomCell *cell = [[CustomCell alloc] init]; CellWithBorder *cellWithBorder = [[CellWithBorder alloc] initWithCell:cell];
If later I wanted to switch to another cell, I would do
CellWithTexture *cellWithBorder = [[CellWithTexture alloc] initWithCell:cellWithBorder.cell];
Mar abdelhafith
source share