Closed. This question is off-topic。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        6年前关闭。
                                                                                            
                
        
我想双击大小为(159,182)的UIwebview,我想将其扩展到全屏大小(它覆盖整个屏幕),我也希望它能够再次双击完整的webview,然后将其制成可以使用正常尺寸(159,182)吗?

最佳答案

向其中添加一个UITapGestureRecognizer。在viewDidLoad中:

UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap)];
doubleTap.numberOfTapsRequired = 2;
doubleTap.delegate = self;
[webView addGestureRecognizer:doubleTap];


不要忘记将UIGestureRecognizerDelegate添加到头文件中。

在viewDidUnload中删除UITapGestureRecognizer。

同时添加此方法

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer    *)otherGestureRecognizer {
    return YES;
}


然后实现代码以在其中调整UIWebView的大小

- (void)doubleTap
{
    ...
}

关于ios - 双击UIwebview以全屏显示,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20608462/

10-13 06:14