I have created custom UIButton and add these methods:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
self.layer.backgroundColor = self.highlightedColor.CGColor;
[self setTitleColor:self.highlightedTextColor forState:UIControlStateNormal];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
self.layer.backgroundColor = [UIColor clearColor].CGColor;
[self setTitleColor:self.highlightedColor forState:UIControlStateNormal];
}
I also use storyboard and I have added segue to the custom button and try to push new view controller.
But seems touches methods conflict with my segue and the new controller never appear by pressing custom button. If I remove -touchesBegan
and -touchesEnded
methods it works good and the new view controller appears.
I don't add any code for trigger segue just use storyboard 'arrows'.