Two ways to set your property and your setter method get called.
1、Dot Syntax : self.isSelected = YES ; 2、call it directly. [set setIsSelected:YES] ;
@interface MyView : UIView
@property (nonatomic) BOOL isSelected;
@end
@implementation MyView
@synthesize isSelected;
-(void)setIsSelected:(BOOL)_isSelected
{
isSelected = _isSelected;
//Custom code that changes UI based on bool state
}
@end
Your app crash because you call self.isSelected = _isSelected
in your setter method, it will call your setter method recursively and endlessly until the stack over flow !