项目问题集

2017-11-27  本文已影响0人  d546d748d718

这是一个实现UIScrollView中,某一栏内容自动弹到顶端的功能,用的是SpringPanel。

if (Input.GetKeyDown(KeyCode.A))
{
grid.Reposition();
scrollView.ResetPosition();
float y = NGUIMath.CalculateRelativeWidgetBounds(grid.transform).size.y;
print(y);
if (y <= 300)
{
scrollViewHeight.clipRange = new Vector4(0, -0.5fy, 302, y);
}
else
{
y = 300;
scrollViewHeight.clipRange = new Vector4(0, -0.5f
y, 302, y);
}
bg.height = (int)y + 100;
SpringPanel.Begin(sV, new Vector3(0, -50, 0), 60f);
scrollView.transform.localPosition = new Vector3(0,-50,0);
grid.transform.localPosition = new Vector3(0, 0, 0);

    }
    if (Input.GetKeyDown(KeyCode.S))
    {

        grid.Reposition();
        float y = NGUIMath.CalculateRelativeWidgetBounds(grid.transform).size.y;
        bg.height = (int)y + 100;
        scrollView.ResetPosition();
        
    }

    ![QQ截图20171124201256.png](https://img.haomeiwen.com/i6288970/4cc1f3bb4ecce16b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
QQ截图20171124201311.png
上一篇下一篇

猜你喜欢

热点阅读