问题描述
我有1类(即延长是UIComponent)被重新presenting一个组成部分。在这部分我创建另一个类,这也是一个UIComponent的不同实例,但这一类并不在去头等舱出现。我看到它正在运行,并且它具有正确的hights,但我的感觉是,它不与这个hights显示出来。如果我跟踪我看到的宽度和高度为200×200,但仍然有任何看得见我的成分
I have 1 class (that is extending a UIcomponent) that is representing a component. In that component I create different instances of another class that is also a UIComponent but this class doesn't show up in de first class. I see that it is running and that it has the correct hights but I got the feeling that it doesn't show up with this hights. If I trace I see the width and height is 200 X 200 but there is still nothing visible in my component
我敢打赌,有这个问题?
I bet there is a simple solution for this problem?
推荐答案
如果直接扩展UIComponent,而你必须确保覆盖所有正确的方法,包括 createChildren
, 的updateDisplayList
和测量
。如果你错过任何这些是行不通的。
If extending UIComponent directly, you have to make sure to override all the right methods, including createChildren
, updateDisplayList
, and measure
. If you miss any of those it won't work.
记住的AddChild在createChildren,设置X,Y,宽度和高度的updateDisplayList中,并在测量设置自己的性能进行测试。
Remember to addChild in createChildren, to set x, y, width, and height in updateDisplayList, and to set your own measured properties in measure.
修复,它通过设置一切都在一个UIComponent可能是不正确的想法。
"Fixing" it by "setting everything in one UIComponent" is probably not the right idea.
这就是说,它通常是一个更容易只是把东西到画布上,而不是扩展UIComponent。一切都将出现在默认情况下,你没有覆盖任何东西。我只延长,当我做一些UIComponent真正看中的还是我想自定义控件
That said, it's usually A LOT easier to just put stuff into a canvas instead of extending UIComponent. Everything will show up by default, and you don't have to override anything. I only extend UIComponent when I'm doing something really fancy or I want custom control
这篇关于UIComponent扩展类没有显示UIComponent扩展的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!