UINavigationController's视图中大约有6-7个UIButtons 。 所有按钮都会在UINavigationController上推送新视图。
这是我的问题,
IOS 7:
问题:如果我同时点击2个按钮,应用程序正在加载一个新视图,但是当我按下按钮时,它正在崩溃应用程序。
原因:它正在堆栈上推送2个视图。
对于iOS 6,它工作正常,有没有什么方法可以限制同时为iOS 7点击2个按钮?
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?
最满意答案
通过这里提供的答案之一,我为我的整个应用程序修改了它。 我创建了一个继承UIButton类的新类,并在该类中添加了一个方法
- (id)initWithCoder:(NSCoder *)inCoder{ self = [super initWithCoder:inCoder]; if (self) { //do custom [self setExclusiveTouch:YES]; } return self; }之后我用这个类代替UIButton。
Benifit:不需要出口。
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.
更多推荐
发布评论