iPhone - 请问有什么可以隐藏视图,让它的其他视图中使用空格(如Android的知名度= GONE) [英] iPhone - how may I hide a view and let it's space be used by other view (like android visibility = GONE)

查看:237
本文介绍了iPhone - 请问有什么可以隐藏视图,让它的其他视图中使用空格(如Android的知名度= GONE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你知道一个简单的(或并不简单)的方式来隐藏视图(或任何类似的视图),让屏幕的其它视图使用留空的地方吗?而后面显示该视图时作出相反。像Android的能见度= GONE图层。

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.

据我所知,使用setHidden = YES只能隐藏在屏幕的看法,但它周围没有任何重新安排。

As far as I know, using setHidden=YES only hide the view from the screen but does not rearrange anything around it.

对于Android中,有2 hidding方法。一个像知名度=隐藏,另:知名度= GONE

On Android, there are 2 hidding method. One like visibility = HIDE, and the other : visibility = GONE.

让我们说我们有各3次与100像素的高度。
在Android上:
如果设置视图2知名度=隐藏,它只是隐藏,并没有什么事情发生。
如果设置视图2的可见性=不见了,视图2从屏幕隐藏和VIEW3 automaticaly采用由视图2释放的地方。

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.

这就是我期待在​​iPhone上。
我想有没有自动的方式做到这一点,但你知道做任何片段或code这可能吗?

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 ?

感谢您

推荐答案

有没有自动平铺在iOS中,所以要做到这一点的唯一方法是你如何希望他们自己每个视图调整为,或许是实施 layoutSubviews 在他们的SuperView。

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.

这篇关于iPhone - 请问有什么可以隐藏视图,让它的其他视图中使用空格(如Android的知名度= GONE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆