I have subclassed UITableViewCell for a custom cell view along the lines as follows:
@interface CustomCell : UITableViewCell
@property (nonatomic, strong) IBOutlet UILabel *customTextLabel;
@end
Is there a way to get rid of the default “textLabel” such that the following code will fail:
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:@"CustomCell"];
[cell.textLabel setText:@"whee"];
I want to restrict usage such that the only text label that can be set is my “customTextLabel”.
Thanks for your help.
You can override the getter for text label returning (a) your label or (b) nil:
This will prevent users of your derived class from accessing the label of the base cell type.