【发布时间】:2011-01-21 22:48:16
【问题描述】:
当用户选择UISegmentedControl 上的选项卡时,我有一个UIWebview 作为子视图加载。出于某种原因,我无法让它允许pinch/zooming。
我在viewDidLoad: 方法中设置了以下代码,所以它应该可以工作。
self.myWebView = [[[UIWebView alloc] initWithFrame:self.view.frame] autorelease];
self.myWebView.backgroundColor = [UIColor whiteColor];
self.myWebView.scalesPageToFit = YES;
self.myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.myWebView.delegate = self;
[self.view addSubview: myWebView];
我尝试从 NIB 加载 UIWebView 并以编程方式创建它,但无济于事。有什么我想念的吗?什么可能导致 webview 忽略捏合和缩放?
谢谢!
【问题讨论】:
-
scalesPageToFit = YES它可以工作,但它会更改您的默认内容大小,Look at my answer this will helpful for you.
标签: iphone uiwebview zooming subview