UIWebView 在 iPhone 模拟器上不显示滚动条

发布于 2024-09-07 09:41:13 字数 919 浏览 7 评论 0原文

CGRect fullFrame = CGRectMake(10, 150, 300, 200);

UIWebView *fullTextView = [[UIWebView alloc] initWithFrame:fullFrame];
fullTextView.userInteractionEnabled = YES;

NSString *imagePath = [[MDImageManager sharedImageManager].imagesPath copy];
imagePath = [imagePath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
imagePath = [imagePath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
NSString *imageName = [[MDImageManager sharedImageManager] loadImage:[NSURL URLWithString:currentCoupon.fullImageURL]];
NSString *HTMLData = [NSString stringWithFormat: @"<img src=%@ />", imageName];

[fullTextView loadHTMLString:HTMLData baseURL:[NSURL URLWithString: [NSString stringWithFormat:@"file:/%@//",imagePath]]];

[view addSubview:fullTextView];

图像加载并显示,但 Web 视图没有滚动条!

fullTextView 添加到视图控制器,包含在导航 + 选项卡视图控制器中,这可能是问题吗?

非常感谢任何帮助!

杰拉尔德

CGRect fullFrame = CGRectMake(10, 150, 300, 200);

UIWebView *fullTextView = [[UIWebView alloc] initWithFrame:fullFrame];
fullTextView.userInteractionEnabled = YES;

NSString *imagePath = [[MDImageManager sharedImageManager].imagesPath copy];
imagePath = [imagePath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
imagePath = [imagePath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
NSString *imageName = [[MDImageManager sharedImageManager] loadImage:[NSURL URLWithString:currentCoupon.fullImageURL]];
NSString *HTMLData = [NSString stringWithFormat: @"<img src=%@ />", imageName];

[fullTextView loadHTMLString:HTMLData baseURL:[NSURL URLWithString: [NSString stringWithFormat:@"file:/%@//",imagePath]]];

[view addSubview:fullTextView];

The image loads and appears, but the web view has no scrolling bars!

The fullTextView is added to a viewcontroller, contained in a navigation + tabbar view controller, could it be the problem?

Any help greatly appreciated!

Gerald

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别理我 2024-09-14 09:41:13

这不是导航或标签栏问题。

uiwebview 包含一个 uiscrollview 作为 provate 属性,你无法正常访问它。

您可以通过破解组件并找到 UIScrollview 子视图来找到 Uiscrollview,也可以直接使用自己的 UIScrollView,它具有scrollIndicators 方法。

你也可以参考这个帖子:
如何显示 UIWebView 的滚动指示器

That's not a navigation nor tabbar problem.

The uiwebview contains a uiscrollview as a provate attribute, and you can't access it normally.

You can either find the Uiscrollview by hacking the component and finding the UIScrollview subview or directly use by yourself an UIScrollView, wich has scrollIndicators methods.

You can refer to this post too :
How to show UIWebView's scroll indicators

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文