NGUI UIinput 取消移动端拖动输入框弹出输入键盘

在手机项目里经常会遇到一种情况:把UIinput放入UIScrollView对象中用于拖动,但是只要一拖动就弹出输入键盘,无言以对呀。

修改部分

493行到521行

#if !MOBILE
[System.NonSerialized] UIInputOnGUI mOnGUI;
#endif
///


/// Selection event, sent by the EventSystem.
///



protected virtual void OnSelect (bool isSelected)
{
if (isSelected)
{
#if !MOBILE
if (mOnGUI == null)
mOnGUI = gameObject.AddComponent();
#endif
OnSelectEvent();
}
else
{
#if !MOBILE
if (mOnGUI != null)
{
Destroy(mOnGUI);
mOnGUI = null;
}
#endif
OnDeselectEvent();
}
}

改为:



#if !MOBILE
[System.NonSerialized] UIInputOnGUI mOnGUI;
#endif
///


/// Selection event, sent by the EventSystem.
///

/// 
private void OnClick()
{


#if !MOBILE
if (mOnGUI == null)
mOnGUI = gameObject.AddComponent();
#endif
OnSelectEvent();
}
protected virtual void OnSelect (bool isSelected)
{
if (!isSelected)
{


#if !MOBILE
if (mOnGUI != null)
{
Destroy(mOnGUI);
mOnGUI = null;
}
#endif
OnDeselectEvent();
}
}


你可能感兴趣的:(unity3D)