Search code examples
xcodetouchuibarbuttonitem

UIBarButtonItem, set exclusive touch


Is there a way to make UIBarButtonItem exclusive touch? At the moment you can select multiple at the same time and it keeps crashing my application.


Solution

  • Slightly easier method than subclassing the navbar but the same idea;

    for(UIView *temp in self.navigationController.navigationBar.subviews)
    {
        [temp setExclusiveTouch:YES];
    }
    

    Put this just after you add your bar button items.