You need to access the backing iVar for the selected
property in the setter
-(void)setSelected:(BOOL)selected {
if (_selected != selected) {
_selected = selected;
}
}
Assigning self.selected = selected
will call the setter, and calling this inside the setting will result in an endless loop!