我正在寻找一种方法来禁用WKWebView的iOS实现上的"捏缩放"放大手势.OS X有一个放大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;
Run Code Online (Sandbox Code Playgroud)
我也试过看看WKWebView的手势识别器,但这似乎是一个空阵列.我假设实际的识别器在组件的结构中更深(比较复杂,看起来很复杂),如果可能的话,宁愿不去挖掘它们.
我知道可能存在可能会禁用手势的黑客攻击(有选择地将手势传递给WebView,添加子视图以捕获捏手势等)但我总是发现那些引入滞后的事件并希望将实现保持为尽可能清洁/黑客.
我正在尝试创建一个圆形加载栏,并希望使用Core Graphics而不是屏蔽图像来创建效果.但是,我没有得到我所希望的忠诚度:
无论我尝试过什么,锯齿似乎都很糟糕.Antialiasing正在进行中,我已经尝试将"平坦度"降低到.1 CGContextRef.图像来自(Retina)模拟器,它在设备上看起来稍微好一点,但仍然不是那么好.
在CALayer的子类中绘制代码:
-(void)drawInContext:(CGContextRef)ctx {
CGPoint center = CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2);
CGFloat delta = toRadians(360 * percent);
CGFloat innerRadius = 69.5;
CGFloat outerRadius = innerRadius + 12;
CGContextSetFillColorWithColor(ctx, [UIColor colorWithRed:99/256.0 green:183/256.0 blue:70/256.0 alpha:.5].CGColor);
CGContextSetStrokeColorWithColor(ctx, [UIColor colorWithRed:99/256.0 green:183/256.0 blue:70/256.0 alpha:10.0].CGColor);
CGContextSetLineWidth(ctx, 1);
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRelativeArc(path, NULL, center.x, center.y, innerRadius, -(M_PI / 2), delta);
CGPathAddRelativeArc(path, NULL, center.x, center.y, outerRadius, delta - (M_PI / 2), -delta);
CGPathAddLineToPoint(path, NULL, center.x, center.y-innerRadius);
CGContextAddPath(ctx, path);
CGContextFillPath(ctx); …Run Code Online (Sandbox Code Playgroud)