Swift 如何停止使用滑出菜单后面的其他视图

How to stop use of other views behind a slide out menu in Swift

我有一个滑出式菜单,可以通过滑动手势从 table 视图顶部的左侧滑入和滑出。但是当菜单出来时,我仍然可以 select 单元格并滚动菜单滑出的 table 视图。

任何帮助都会很棒谢谢

在 SlideMenuView 上设置 "setExclusiveTouch:YES"。

来自 iPhone OS 编程指南:

将事件传递限制为单个视图:

By default, a view’s exclusiveTouch property is set to NO. If you set the property to YES, you mark the view so that, if it is tracking touches, it is the only view in the window that is tracking touches. Other views in the window cannot receive those touches. However, a view that is marked “exclusive touch” does not receive touches that are associated with other views in the same window. If a finger contacts an exclusive-touch view, then that touch is delivered only if that view is the only view tracking a finger in that window. If a finger touches a non-exclusive view, then that touch is delivered only if there is not another finger tracking in an exclusive-touch view.

使用QuartzCore

import QuartzCore

/* .. */

slideOutMenu.layer.zPosition = 1;

您的 slideOutMenu 将位于 UITableView 的顶部。