UIWebView 在 iPhone 模拟器上不显示滚动条
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是导航或标签栏问题。
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