To remove the space occupied by a view, you can either reduce the size its frame to zero, or remove it from the view hierarchy. That is, calling removeFromSuperview on the control.
For example, if you need to remove the space occupied by a UITextField (say CONTROLNAME ), you can either use:
CGRect tempFrame = CONTROLNAME.frame; CGSize currentSize = tempFrame.size;
or
CGRect currentFrame = CONTROLNAME.frame;
UPDATE:
In the first case, you will need to save an earlier size in order to return the control to its original position.
CGRect tempFrame = CONTROLNAME.frame; tempFrame.size = currentSize; //set to initial value CONTROLNAME.frame = tempFrame;
In the second case, you will need to save the frame of the control in order to return it to its original position (as well as the control itself, if it is a local variable or a weak instance variable).
CONTROLNAME.frame = currentFrame;
Rakesh Mar 28 '14 at 6:25 2014-03-28 06:25
source share