- Home /
How to drag a scrollView with TouchPhase.Moved?
Hello, all together!
I have now spent two days with trying to make a simple scroll view draggable on the iPhone/iPad. I don't want to use scrollbars. I want to drag the content by swiping over it. For this I tried to use "TouchPhase.Moved" but unfortunately I obviously don't understand how to make it work as simple as possible. Can You help me, please?
This is the java code for the ScrollView:
//////////////////////////////////////////////////////////
var ContentImage : Texture2D;
public var scrollBoxWidth = 280; public var scrollBoxHeight = 120;
var scrollPosition : Vector2 = Vector2.zero; var style : GUIStyle;
private var textStyle : GUIStyle = new GUIStyle();
function OnGUI () {
GUILayout.BeginArea(new Rect(Screen.width * 0.5 - scrollBoxWidth / 2, Screen.height-205, scrollBoxWidth, scrollBoxHeight));
GUI.skin.scrollView = style;
scrollPosition = GUILayout.BeginScrollView (scrollPosition, GUILayout.Width(scrollBoxWidth), GUILayout.Height(scrollBoxHeight));
GUILayout.Label(ContentImage);
GUILayout.EndScrollView ();
GUILayout.EndArea();
}
////////////////////////////////////////////////////////////////
Your answer
Follow this Question
Related Questions
rotated GUI behaving differently on iphone and ipad 1 Answer
iphone like date pickers 1 Answer
iOS falls asleep when not touching screen 1 Answer
iOS camera and terrain size 0 Answers
WWW error on ios 1 Answer