问题描述
我正在使用 textField
启动一个简单的 UIView
- 让我们称之为 orderSetNameView
- 按下按钮。我希望将此视图设为模态,但不使用
I am launching a simple UIView
with a textField
- let's call it orderSetNameView
- upon a button tap. I wish to make this view modal, but without using a
[UIViewController presentModalViewContoller:animated:]
。
似乎我可以简单地设置 textInputView.exclusiveTouch = YES
来实现这一点。
It seems I could simply set textInputView.exclusiveTouch = YES
to achieve that.
Apple文档说明 exclusiveTouch
:
Apple documentation says about exclusiveTouch
:
我假设相同窗口表示相同的UIWindow,其中我只有一个。
I assume "same window" means same UIWindow, of which I have only one.
问题在于,当我实例化我的orderSetNameView时,将其添加为子视图,并设置 exclusiveTouch = YES
,触摸事件发生在我的应用的所有其他视图中,即其他视图中的触摸事件未按预期阻止。
The problem is that when I instantiate my orderSetNameView, add it as a subview, and set exclusiveTouch = YES
, touch events happen in all other views of my app, i.e., touch events in other views are not blocked as expected.
// ....
[self.view addSubview:self.orderSetNameView];
[self.orderSetNameView openWithAnimationForAnimationStyle:kMK_AnimationStyleScaleFromCenter];
}
// Set as modal
self.orderSetNameView.exclusiveTouch = YES;
不应该 orderSetNameView
阻止触摸事件所有其他观点?我缺少什么?
Shouldn't orderSetNameView
block touch events in all other views? What am I missing?
推荐答案
来自Apple开发者论坛:
From Apple developer forums:
这篇关于为什么UIView的exclusiveTouch属性没有阻塞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!