Search code examples
iosobjective-canimationuinavigationcontrolleruibutton

Why system UIButton don't animate when it is near Navigation controller space (left)


Why this happened when you click at the button near left side of the View Controller ?

Gif showing how button on the left is not active

I suspect it is because of presence of Navigation Controller, but I'm not sure.

Could I make button to animate even though I click at this space ?


Solution

  • I suspect this is because of the UINavigationController's interactivePopGestureRecognizer is interfering with the touch events of that button.

    Try adding this code in your view controller:

    self.navigationController.interactivePopGestureRecognizer.cancelsTouchesInView = NO;      
    self.navigationController.interactivePopGestureRecognizer.delaysTouchesBegan = NO;
    self.navigationController.interactivePopGestureRecognizer.delaysTouchesEnded = NO;
    

    bluesm's EDIT:

    It looks like

    self.navigationController.interactivePopGestureRecognizer.delaysTouchesBegan = NO;
    

    is sufficient to bring the "alpha" animation back to the system's UIButtton of iOS 7.