简体   繁体   English

如何设置滚动视图位置以便在Ngui的ui滚动视图中显示新的实例化ui面板

[英]How to set the scroll view position so as to display the new instantiated ui panel in the ui scroll view in ngui

My question is related to ui scroll view in ngui I have a set of panels in a scroll view that move horizontally. 我的问题与ngui中的ui滚动视图有关。我在滚动视图中有一组水平移动的面板。 I use NGUITools.AddChild to add a new panel. 我使用NGUITools.AddChild添加一个新面板。 I position this new panel to the end of the scroll view. 我将这个新面板放置在滚动视图的末尾。

The problem is that i want to move towards the new panel that was created and placed at the end of scroll view but i am not able to find a proper solution to this issue. 问题是我想转到已创建并放置在滚动视图末尾的新面板,但是我无法找到解决此问题的合适方法。

I tried to move the whole grid manually but then the scroll view would move to some other place leaving the camera's view as the offset values get changed when i move the grid manually. 我尝试手动移动整个网格,但是当我手动移动网格时,偏移值会更改,因此滚动视图会移动到其他地方,离开摄像机的视图。

I tried to move the camera but the same issue occurred. 我试图移动相机,但是发生了同样的问题。

I tried using UIScrollView.ResetPosition() but this actually changed the scroll views position to the top left corner ie the first ui panel child in scroll view. 我尝试使用UIScrollView.ResetPosition(),但这实际上将滚动视图的位置更改为左上角,即滚动视图中的第一个ui面板子级。

But i want to move towards the last ui panel child in scroll view. 但是我想在滚动视图中移向最后一个ui面板子级。

Is there any class available that sets the position of the scroll view to a particular panel. 是否有可用的类将滚动视图的位置设置到特定面板。 I want to move the panels or the camera whatever is feasible to display the panel i want to without affecting any offset values and the on drag values. 我想在不影响任何偏移值和拖拽值的情况下,移动面板或摄像机,尽可能显示我想要的面板。

Thank you for reading. 感谢您的阅读。

您可以使用UICenterOnChild.CenterOn(转换目标)将面板居中到特定目标: http ://www.tasharen.com/ngui/docs/class_u_i_center_on_child.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM