iOS 7中的PushViewController(PushViewController in iOS 7)

编程入门 行业动态 更新时间:2024-10-26 08:34:08
iOS 7中的PushViewController(PushViewController in iOS 7)

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.

更多推荐

本文发布于:2023-08-05 21:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1437883.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:iOS   PushViewController

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!