问题
Do you know a simple (or not simple) way to hide a view (or anything like a view) and let the other views of the screen use the place left blank ? And make the opposite when showing back that view. Something like Android Visibility = GONE for layers.
As far as I know, using setHidden=YES only hide the view from the screen but does not rearrange anything around it.
On Android, there are 2 hidding method. One like visibility = HIDE, and the other : visibility = GONE.
Let's say we have 3 views each with an height of 100px. On Android : If you set view2 visibility = HIDE, it just hides, and nothing else happens. If you set view2 visibilty = GONE, the view2 hides from the screen and the view3 automaticaly takes the place freed by view2.
That's what I'm looking to on the iPhone. I imagine there no auto way to do this but do you know any snippet or code making this possible ?
Thank you
回答1:
There's no auto-tiling in iOS, so the only way to do this is to resize each of the views to how you want them to be yourself, perhaps by implementing layoutSubviews
on their superview.
来源:https://stackoverflow.com/questions/4741985/iphone-how-may-i-hide-a-view-and-let-its-space-be-used-by-other-view-like-an