UI Image rectTransform's posX in C#

Hello guys

Does anyone know how to access Pos X of a UnityEngine.UI Image object?

I want a slider to appear from offscreen to a posX and be able to hide it back in, in C#.

This video is great but doesn’t mention how to do this programatically.

Thanks

According to http://docs.unity3d.com/ScriptReference/UI.Image.html there is a rectTransform property which should give you access to all the rectangle transform properties seen in the inspector.

I had already looked into that property, but in practice this:

sliderToHide.rectTransform.rect.max = 50.0f;

Won’t work. It returns a read only error.