“枚举时发生突变” Titanium 项目中半随机出现错误
我相信你们之前都在 Titanium 移动项目中见过这个错误。我已经在我正在开发的应用程序中获得了它。它通常是由相同类型的操作引发的,但不是一直抛出,也不是在同一个地方抛出。我想知道是否有人找到了这个问题的解决方案。
当我迭代对象数组并使用该数据创建视图时,通常会生成该错误。每个新视图都位于其前一个视图的下方,因此新视图的 top 属性看起来像这样:
top = (from_top + old_view.height + 10);
正如您所看到的,我正在使用 view.height 属性来计算我的 top 属性,我认为这是问题的一部分。任何人都对此有任何运气,或者您是否正在使用解决方法来避免另外使用视图的高度属性?
(这也发布在 Appcelerator 问答网站)
I'm sure you've all seen this error before in your Titanium mobile projects. I've been getting it in an app I'm working on. It is usually thrown by the same type of operation, but not all the time and not in the same place. I'm wondering if anyone has found a solution to this issue yet.
The error is usually generated when I am iterating through an array of objects, and using that data to create views. Each new view is below its previous sibling, so the new view's top property looks something like this:
top = (from_top + old_view.height + 10);
As you can see I'm using the view.height property to figure out my top property, and I assume this is part of the problem. Anyone had any luck with this, or are you using a work around to avoid using a view's height property in addition?
(This is also posted on the Appcelerator Q&A site)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不使用 layout: 'vertical' 而不是手动指定高度?目前它不在文档中,但从 1.5 开始,您可以在窗口和滚动视图上指定布局:'vertical',也可能在视图上指定。适用于 iOS 和 Android。
Why don't you use layout: 'vertical' instead of manually specifying the heights? It isn't in the docs at the moment, but as of 1.5 you can specify layout: 'vertical' on windows and scrollviews, possibly on views as well. Works on both iOS and Android.