How do I create an invisible joystick that appears anywhere on the iOS screen?

Hi,
I’m creating a third person game and I want to make a single joystick controller but there are two distinctive things I want this joystick to do. I want it to be invisible until the player touches the screen. Then it becomes visible under the player’s finger. I also want, and this is the hard part, to have the player be able to touch anywhere on the screen and have the joystick appear. I don’t want it to be set in any particular location.
Is there anywhere that I might be able to find this information or can anyone help me to create it?
Thanks so much!
Tom

Here’s my version of the code that does that. Basic idea is wait for a touch to be down, use that as the center of the joystick, and then compute the joystick deflection as the difference between current finger pos and initial pos.

    protected class TrackedTouch
    {
    	public Vector2 startPos;
    	public Vector2 currentPos;
    }

    void _UpdateTouches()
	{
		int numTouches = Input.touchCount;
		for(int touchIndex = 0; touchIndex < numTouches; ++touchIndex)
		{
			Touch touch = Input.touches[touchIndex];
			if(touch.phase == TouchPhase.Began)
			{
				Debug.Log("Touch " + touch.fingerId + "Started at : " + touch.position);
				TrackedTouch newTouch = new TrackedTouch();
				newTouch.startPos = touch.position;
				newTouch.currentPos = touch.position;
				_touches.Add(touch.fingerId, newTouch);
			}
			else if(touch.phase == TouchPhase.Canceled || touch.phase == TouchPhase.Ended)
			{
				Debug.Log("Touch " + touch.fingerId + "Ended at : " + touch.position);
				_touches.Remove(touch.fingerId);
			}
			else
			{
				TrackedTouch currentTouch;
				if(_touches.TryGetValue(touch.fingerId, out currentTouch))
				{
					currentTouch.currentPos = touch.position;
				}
			}
		}

	}

    protected Vector2 GetScreenJoystick(bool left)
    {
    	foreach(TrackedTouch touch in _touches.Values)
    	{
    		float halfScreenWidth = Screen.width * 0.5f;
    		if((left && touch.startPos.x < halfScreenWidth) ||
    		   (!left && touch.startPos.x > halfScreenWidth))
    		{
    			Vector2 screenJoy = touch.currentPos - touch.startPos;
    			screenJoy.x = Mathf.Clamp(screenJoy.x / (halfScreenWidth * 0.5f * TouchScreenLookScale), -1f, 1f);
            		screenJoy.y = Mathf.Clamp(screenJoy.y / (Screen.height * 0.5f * TouchScreenLookScale), -1f, 1f);
    			return screenJoy;
   			}
   		}
   		return Vector2.zero;
   	}