touchesBegan and touchesEnded conflict with segue when push new view controller

225 views Asked by At

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'.

0

There are 0 answers