简体   繁体   English

通过录音放大uiwebview?

[英]zoom in on a uiwebview by taping?

In Safair mobile you can zoom in by double taping if you have a html page that you display. 在Safair移动设备中,如果您有一个显示的html页面,可以通过双击放大。 But if you use a uiwebview and display an image or pdf file you have to pinch open to zoom. 但是如果您使用uiwebview并显示图像或pdf文件,则必须捏开以进行缩放。

My question is: what do I have to do to get double tap to work when displaying an image or pdf file ia uiwebview? 我的问题是:在显示图像或pdf文件时,我需要做什么才能使用uiwebview?

Can you make the uiwebview a sub view under a uiscrollview, will you then be able to double tap an zoom? 你可以在uiscrollview下将uiwebview作为子视图,然后你可以双击缩放吗? And how would you do that? 你会怎么做?

What a double tap in Mobile Safari really does is focus on the content. Mobile Safari真正做的双点是关注内容。 It will find the div or section on the web page that you tapped on and then zoom to focus. 它将在您点击的网页上找到div或部分,然后缩放以进行聚焦。 It is not simply 'double tap to zoom'. 它不仅仅是“双击缩放”。

To get double tap from UIWebview u need to subclass the UIWindow and use the method, 要从UIWebview中双击,你需要子类化UIWindow并使用该方法,

- (void)sendEvent:(UIEvent *)event {
    NSLog(@"tap detect");
    NSArray *allTouches = [[event allTouches] allObjects];
    UITouch *touch = [[event allTouches] anyObject];
    UIView *touchView = [touch view];

    if (touchView && [touchView isDescendantOfView:urWebview]) {
        //
        // touchesBegan
        //
               if(touch.tapCount==2){
                     //
                // doubletap
                //
               }
       }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM