how to hide the title bar(top bar) in iphone from a view [duplicate]

隐身守侯 提交于 2019-12-02 04:12:26

问题


Possible Duplicate:
Hide the status bar on iPhone on a single view?

I want to hide the title bar in iphone from my first welcome view and also from the splash screen, how can i hide it(top bar, not the navigation bar).

I saw a post with this

    [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

but this hides the title bar through out the application. I just want to hide it from the first view.


回答1:


The easiest way to hide the status bar is to go into youInfo.plist; right click to add a row and select Status Bar Initially hidden.

This will ensure every time you app launches the status bar will be hidden.

Edit

with programming

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 44);

and when you want to show the statusbar just use bellow code..

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.frame = CGRectMake(0, 45, 320, 44);

i hope this help you...

:)




回答2:


In AppDelegate class applicationDidFinishLaunching ,write the below code

- (void) applicationDidFinishLaunching:(UIApplication *)application
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
}

All other views (except first View) when you need to display StatusBar, write the below code in curresponding ViewDidiLoad() / viewWillAppear,

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];



回答3:


in your info.pist find this option. "Status bar is initially hidden" And set as YES.




回答4:


Depends which version of Xcode you are using.

In 4.5 you can go into the build settings "Summary" tab and set this in the "Status Bar" section.

If you don't have 4.5 then in the build settings "Info" section add a plist entry for "Status Bar Is Initially Hidden" and set it to YES. (Alternatively, download Xcode 4.5 because you should do this anyway).



来源:https://stackoverflow.com/questions/12929951/how-to-hide-the-title-bartop-bar-in-iphone-from-a-view

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