【发布时间】:2011-10-11 00:18:31
【问题描述】:
我想禁用UIWebview里面的滚动,需要根据UIWebview的宽高显示内容。如果内容足够大,可以在页面上显示,它应该像 UILabel 中那样在文本的末尾显示 ...
flipboard 应用程序在第一页上显示部分内容的地方做得很好,当我们捏缩放它时,更多的内容会根据高度和宽度显示在视图上。
如何实现。对此的任何帮助表示赞赏。
示例:
我正在 iPad 上加载这个
UIWebView *mWebView = [[UIWebView alloc] initWithFrame:CGRectMake(100, 100, 500, 730)];
mWebView.backgroundColor=[UIColor greenColor];
mWebView.userInteractionEnabled=YES;
mWebView.autoresizingMask=YES;
mWebView.delegate = self;
for (id subview in mWebView.subviews)
if ([[subview class] isSubclassOfClass: [UIScrollView class]])
((UIScrollView *)subview).bounces = NO;
for (id subview in mWebView.subviews)
if ([[subview class] isSubclassOfClass: [UIScrollView class]])
((UIScrollView *)subview).showsVerticalScrollIndicator = NO;
for (id subview in mWebView.subviews)
if ([[subview class] isSubclassOfClass: [UIScrollView class]])
((UIScrollView *)subview).scrollEnabled= NO;
[self.view addSubview:mWebView];
[mWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://mobile.washingtonpost.com/c.jsp;jsessionid=E6B119C6EF5A6274030E7B3A9F97D374?item=http%3a%2f%2fwww.washingtonpost.com%2fpolitics%2fobama-gop-leaders-said-to-discuss-new-debt-plan%2f2011%2f07%2f21%2fgIQAT81BSI_mobile.mobile&cid=578815"]]];
[mWebView release];
我只想显示可以在帧 500,750 上显示的那么多内容。正如您在屏幕截图中看到的,最后一行被剪掉了。
【问题讨论】:
标签: javascript iphone html ios ipad