Reputation: 1005
There are around 6-7 UIButtons
on a UINavigationController's
view.
All buttons push a new view on the UINavigationController
.
Here is my problem,
iOS 7:
Problem: if I tap 2 buttons simultaneously, application is loading a new view but, when I push back button, It is crashing the application.
Reason: It is pushing 2 views on the stack.
For iOS 6 it is working fine, is there any way we can restrict tapping 2 buttons simultaneously for iOS 7?
Upvotes: 3
Views: 728
Reputation: 1005
With one of the answers provided here, I modified it for my whole application. I created a new class which inherits UIButton class and in that class added a method
- (id)initWithCoder:(NSCoder *)inCoder{
self = [super initWithCoder:inCoder];
if (self) {
//do custom
[self setExclusiveTouch:YES];
}
return self;
}
after that I used this class instead UIButton.
Benifit: no need to make an outlet.
Upvotes: 3
Reputation: 4005
I managed this problem by subclassing UINavigationBar and overriding layoutSubviews method. Something like this:
- (void)layoutSubviews {
[super layoutSubviews];
for (UIView *view in self.subviews) {
view.exclusiveTouch = YES;
}
}
original answer UIBarButtonItem, set exclusive touch
Upvotes: 1
Reputation: 1337
Make Outlets do those buttons and then:
[yourButton setExclusiveTouch:YES];
Upvotes: 1