【发布时间】:2014-10-22 14:32:14
【问题描述】:
我正在寻找一种方法来禁用 WKWebView 的 iOS 实现上的“捏缩放”放大手势。 OS X 有一个 magnification BOOL 属性可用,但它似乎在 iOS 上不可用。
WKWebView.h
#if !TARGET_OS_IPHONE
/* @abstract A Boolean value indicating whether magnify gestures will
change the web view's magnification.
@discussion It is possible to set the magnification property even if
allowsMagnification is set to NO.
The default value is NO.
*/
@property (nonatomic) BOOL allowsMagnification;
我也试过查看 WKWebView 的手势识别器,但这似乎是一个空数组。我假设实际的识别器在组件的结构中埋藏得更深(看起来相当复杂),如果可能的话,我宁愿不去挖掘它们。
我知道可能会导致手势无法触发的黑客行为(选择性地将手势传递给 WebView、添加子视图以捕获捏合手势等),但我一直发现那些会在事件中引入延迟并希望保留实现尽可能干净/无黑客。
【问题讨论】: