o9s
is a microblog
home archives search feed blogroll


setHighlighted on UILabels

setHighlighted exists for UILabels, you can override it, but it does nothing. Here’s how to make it work.

- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
    [super touchesBegan:touches withEvent:event];
    [self setHighlighted:YES];
}

 - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
     [super touchesEnded:touches withEvent:event];
     [self setHighlighted:NO];
 }
 
 - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
     [super touchesMoved:touches withEvent:event];
     [self setHighlighted:NO];
 }

 - (void)setHighlighted:(BOOL)highlighted {
    [super setHighlighted:highlighted];
 
    // Custom implementation
 }
Posted on 2018-10-02   #objc     #ios  






Previous post →