I have used storyboard with autolayout for my UI design. Basically in android there are three different properties will be there like Visible, Invis
To remove the space occupied by a view(control) can either reduce the size
of its frame to zero or remove it from the view hierarchy. I.e. by calling removeFromSuperview
on the control.
For example if you have to remove the space occupied by a UITextField
(say CONTROLNAME
), then you can either use:
CGRect tempFrame = CONTROLNAME.frame;
CGSize currentSize = tempFrame.size; //for later use
tempFrame.size = CGSizeZero;
CONTROLNAME.frame = tempFrame;
or
CGRect currentFrame = CONTROLNAME.frame; //for later use
[CONTROLNAME removeFromSuperview];
UPDATE:
In the first case you will have to store the earlier size to bring back the control to its initial position.
CGRect tempFrame = CONTROLNAME.frame;
tempFrame.size = currentSize; //set to initial value
CONTROLNAME.frame = tempFrame;
In the second case you will have to store the frame of the control to bring it back to its initial position (and also the control itself if it is a local variable or weak instance variable).
CONTROLNAME.frame = currentFrame;