为什么某些小部件元素在嵌入 iBook 中时不显示?
我在 Dashcode 中创建了一个小部件。它有一些按钮、文本字段和文本。从 Dashcode 运行或安装到仪表板中时,它可以正常工作。当我将其安装到 iBook 中(通过 iBooks Author)并在 iPad 上运行时,按钮和文本全部消失(以及其他一些细微的视觉变化)。有趣的是,如果我点击某些按钮所在的位置,它会调用按钮单击事件,但其他按钮则不起作用。此外,当按钮单击事件更新文本的值时,该文本将变得可见。
我尝试了 GlassButtons 和常规按钮,但都没有显示。我检查了有效按钮和无效按钮的属性,它们似乎是相同的(除了 id 和值)。
这是它在 Mac 上运行的屏幕截图:
这是它在 iBooks 中运行的屏幕截图在我的 iPad 上:
请注意文本值已更新的 8。当您点击正确的位置时,连接和更新按钮会起作用,但其他按钮都不起作用。
附带说明一下,此小部件使用 RemObjects SDK for JavaScript,这真的很酷。如果我能让按钮显示出来,网络服务就可以工作。
更新:我用实际的 HTML
。I created a widget in Dashcode. It has some buttons, text fields and texts. It works fine when run from Dashcode or when installed into the Dashboard. When I install it into an iBook (via iBooks Author) and run it on the iPad then the buttons and texts all disappear (as well as a few other minor visual changes). Interestingly if I tap where some of buttons are, it invokes the button click event, but others don't work. Also, when a button click event updates the value of a text then that text becomes visible.
I tried both GlassButtons and regular Buttons, neither shows up. I inspected the properties of the buttons that work vs those that don't and they seem to be the same (beyond id and value).
Here is a screenshot of it running on the Mac:
Here is a screenshot of it running in iBooks on my iPad:
Notice the 8 where a text's value was updated. The connect and update buttons work when you tap in the right spot, but none of the others work.
As a side note, this widget is connecting to a web service over the network using RemObjects SDK for JavaScript, which is really cool. The web service works, if I can just get the buttons to show up.
Update: I replaced the <div>
tag which Dashcode uses for a button with an actual HTML <input type="button">
and that shows up in the iBook. Text still doesn't show up. It is also a <div>
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了。保存小部件时,需要使用最低 Mac OS X 版本 10.4.0 进行保存,该版本被视为“向后兼容”。默认值(至少在我的安装中)是 10.4.3。不同之处在于,当它保存为向后兼容时,则包含渲染按钮和文本的库。为什么它需要特殊的库来渲染文本超出了我的范围。
但需要注意的是,当它在 iBooks 中运行时,文本位置会有点混乱。我认为 Apple 在发布 iBooks Author 和 iBooks 2 之前还没有完成它们。
I figured it out. When saving the widget it needs to be saved with a minimum Mac OS X version of 10.4.0 which is considered "Backwards-compatible". The default (at least on my install) was 10.4.3. The difference is that when it is saved backwards-compatible then the libraries are included that render the buttons and the text. Why it needs special libraries to render text is beyond me.
One note though is the text position gets messed up a bit when it runs in iBooks. I don't think Apple finished iBooks Author and iBooks 2 before they released it.