将 Javascript 注入 UISlider
我已经和一个问题斗争了大约一周,这真的让我很烦恼。 的 javascript 函数
启动ZoomChanger(在此处输入值)
我已将 html 嵌入到 Xcode 中的 uiwebview 中,我想根据 UIslider 的值 。我尝试了这段代码...
NSString *string = [NSString stringWithFormat:@"ZoomChanger(100,200,300);", slider.value];
[webView stringByEvaluatingJavaScriptFromString:string];
但它只放大一次,并且不会继续缩放,并且当 uislider 返回到开头时也不会取消缩放。它在 Android 上运行良好,但我无法让它在 iOS 上运行。
I have been battling a problem now for about a week and it's really annoying me. I have embedded html into a uiwebview in Xcode and i want to launch the my javascript function of
ZoomChanger(Enter Value Here)
based on the value of UIslider. I tried this code...
NSString *string = [NSString stringWithFormat:@"ZoomChanger(100,200,300);", slider.value];
[webView stringByEvaluatingJavaScriptFromString:string];
but it only zooms in once and doesn't continue zooming and won't unzoom when uislider is brought back to the beginning. It works fine on android but I can't get it to work on iOS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您每次都会发送
ZoomChanger(100,200,300);
。我相信您想从滑块发送一个值。
什么是 ZoomChanger?我假设它是一个 javascript 函数
function ZoomChanger(x)
....您将需要类似的东西:
请参阅此doc。
You are sending
ZoomChanger(100,200,300);
each time.I believe you want to send a value from the slider.
What is
ZoomChanger
? I assume it is a javascript functionfunction ZoomChanger(x)
....You will need something like:
See this doc.