UIBarButtonItem, establish an exclusive contact

Is there any way to make an exclusive touch of UIBarButtonItem ? At the moment, you can select several at the same time, and it continues to crash my application.

+7
source share
5 answers

A little simpler than navbar subclassing, but the same idea;

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

Place it right after adding panel elements.

+9
source

I managed to solve this problem by subclassing the UINavigationBar and overriding the layoutSubviews method. Something like that:

 - (void)layoutSubviews { [super layoutSubviews]; for (UIView *view in self.subviews) { view.exclusiveTouch = YES; } } 
+7
source

Immersed in the past, I apologize. I stumbled upon this and hoped that there was a better way than going through subviews.

I found the following: UIBarButtonItems is exclusive:

 [self.navigationController.navigationBar setExclusiveTouch:YES]; 

iOS7 can make an exclusive touch inherited.

+3
source

In iOS 7, it did not work. I used this method to fix it.

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

This does not work for a UIBarButtonItem created using initWithTitle

-2
source

All Articles