How to prevent view resizing/transform when UINavigationBar hides/shows

让人想犯罪 __ 提交于 2019-12-03 15:08:00

I know this is an old question, but I accomplished that by disabling 'Autoresize Subviews' in Interface Builder

MichalMazurek

Had this issue and fixed it with a class that inherited from UINavigationController

-(void)viewWillAppear:(BOOL)animated
{
    self.navigationBar.translucent = YES;
}

Worked great for me, didn't had to set style to UIBarStyleBlackTranslucent. So it did kept my colors.

Stultus
[[navigationController navigationBar] setBarStyle:UIBarStyleBlackTranslucent];
[[navigationController navigationBar] setAutoresizesSubviews:NO];

this seemed to do the trick for me!

I haven't been able to find a proper way to handle this except to set the navigationBar style to translucent as in:

theNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

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)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!