uGUI - resize RectTransform at runtime to fill entire screen

How do you resize a rect transform at runtime to fill the entire screen

I tried .sizeDelta = new Vector2 (Screen.width, Screen.height); - however, this does not seem to go to the actual full size of the screen?

Consider using the anchor position instead.

RectTransform rt = GetComponent<RectTransform>();
rt.anchorMin = Vector2.zero;
rt.anchorMax = Vector2.one;
rt.sizeDelta = Vector2.zero;

Note that it actually works if the parent occupies the whole screen.