当 UINavigationBar 隐藏/显示时如何防止视图调整大小/转换
我有一个带有选项卡栏和导航栏的应用程序。我推送一个用于显示照片的视图控制器,一次一张。它最初显示栏和前进/后退控制;延迟后,这些隐藏,使用标签栏上的 setNavigationBarHidden:animated:
和自定义转换 (CGAffineTransformMakeTranslation
)。这是可行的,但是显示照片的视图控制器 view 会上下跳跃。如果我将选项卡栏排除在等式之外,情况也是如此。
如何防止 UINavigationBar 移动我的视图?我希望照片保持固定在屏幕上,导航栏下降到其顶部。
I have an application with a tab bar and a navigation bar. I push a view controller that is used to show photos, one at a time. It initially shows the bars and forward/back controls; after a delay, these hide, using setNavigationBarHidden:animated:
and a custom transform (CGAffineTransformMakeTranslation
) on the tab bar. This works, but the view controllers view , which shows the photo, leaps up and down. The same is true if I leave the tab bar out of the equation.
How can I prevent the UINavigationBar from moving my view around? I would like the photo to stay fixed in the screen, with the nav bar dropping down over the top segment of it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
遇到这个问题并使用从
UINavigationController
继承的类修复了它,对我来说效果很好,不必将样式设置为
UIBarStyleBlackTranslucent
。所以它确实保留了我的颜色。Had this issue and fixed it with a class that inherited from
UINavigationController
Worked great for me, didn't had to set style to
UIBarStyleBlackTranslucent
. So it did kept my colors.这似乎对我有用!
this seemed to do the trick for me!
我知道这是一个老问题,但我通过在 Interface Builder
中禁用“自动调整子视图大小”来实现这一点
I know this is an old question, but I accomplished that by disabling 'Autoresize Subviews' in Interface Builder
除了将导航栏样式设置为半透明之外,我一直无法找到正确的方法来处理此问题,如下所示:
除了创建另一个导航栏并向其添加按钮之外,这是最好的(这似乎是苹果所做的就在它的照片应用程序中)
I haven't been able to find a proper way to handle this except to set the navigationBar style to translucent as in:
Other than creating another navigation bar and adding buttons to them, that's the best (and it seems to be what Apple does as well in it's Photo app)