美文网首页
项目问题集

项目问题集

作者: d546d748d718 | 来源:发表于2017-11-27 13:05 被阅读0次

    这是一个实现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

    相关文章

      网友评论

          本文标题:项目问题集

          本文链接:https://www.haomeiwen.com/subject/qbnfbxtx.html