Hiding statusbar in iOS7 - iphone

I tried to hide status bar in iOS7 by putting this:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
in delegate or in mainview
But it's not working!
It was working in iOS6

Either set "View controller-based status bar appearance" to NO in your info plist or add this code in your view controllers:
-(BOOL)prefersStatusBarHidden
{
return YES;
}

Add the following to your Info.plist:
UIStatusBarHidden
UIViewControllerBasedStatusBarAppearance
or follow this link http://www.openfl.org/developer/forums/general-discussion/iphone-5ios-7-cant-hide-status-bar/

In a viewController where you want to hide status bar add:
- (BOOL)prefersStatusBarHidden
{
return YES;
}
In viewDidLoad
[self prefersStatusBarHidden];
[self performSelector:#selector(setNeedsStatusBarAppearanceUpdate)];
In app *-info.plist
View controller-based status bar appearance set to YES

Try this.
In your iOS target -> Info, add View controller-based status bar appearance and set the value as NO.
It worked for me in iOS7. I have also set "status bar initially hidden" property to YES

//viewDidload
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:#selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
}
// Add this Method
- (BOOL)prefersStatusBarHidden
{
return YES;
}
this wil work ..hope it helps

In your apps plist file add a row call it " UIViewControllerBasedStatusBarAppearance" and set it to NO
from http://www.openfl.org/developer/forums/general-discussion/iphone-5ios-7-cant-hide-status-bar/, mgiroux's solution

In the Plist add the following properties.
Status bar is initially hidden = YES
View controller-based status bar appearance = NO
now the status bar will hidden.

Related

iOS 7 staus bar issues

I have an application with status bar hidden. For hiding status bar I did following things:
[[UIApplication sharedApplication] setStatusBarHidden:YES];
This was working with ios 6. Now in iOS 7 I added View controller-based status bar appearance = NO.
I also created subclass of my navigation controller and added:
- (BOOL)prefersStatusBarHidden
{
return YES;
}
Everything is working well but when I present UIImagePicker status bar goes visible and than it never hides back even after dismissing view. I also added prefersStatusBarHidden method in the related view too but no success :(
Any help please.
Use following link
- (void)imagePickerController:(UIImagePickerController *)aPicker didFinishPickingMediaWithInfo:(NSDictionary *)info {
// for iOS7
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
Following are the list of reference regarding status bar issues in ios7 on stack overflow Itself. ;-)
Status bar and navigation bar appear over my view's bounds in iOS 7
Status bar won't disappear
Status bar appear over my view's bounds in iOS 7
Use can use this method for status bar Issue.It should work fine.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
UIView *addStatusBar = [[UIView alloc] init];
addStatusBar.frame = CGRectMake(0, 0, 320, 20);
addStatusBar.backgroundColor = [UIColor colorWithRed:0.973 green:0.973 blue:0.973 alpha:1]; //change this to match your navigation bar
[self.window.rootViewController.view addSubview:addStatusBar];
}
Try this in your Target's general settings.

Iphone Tabbar application not rotating

I created a tabbar application. First there were rotation enabled. The app did rotate without any difficulties. But for better usage i commented all auto rotation code and also in the infoplist deleted all other interface except portrait. But now i need it back. I uncommented all code and also added all interface orientation. But the application is not rotating. Please any one help me.Sorry for my bad english
Thanks
Rakesh
Every view controller added to tab bar controller will have
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}
Make sure you return YES in each of them..
create a category like this and this method
#implementation UITabBarController(UITabBarControllerCategory)
-(BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation
{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
if ([AppDelegate isLandScapeOnly]){
return NO;
}
return YES;
}
#end

Hide tab bar on landscape mode

I am working on an app that uses tab bar for each view. (iphone app).
One of the view is a camera view where the user can take picture. Is there a way to hide the tab bar located bottom of the screen when the user changes to landscape mode? Then tab bar can reappear when it switches to portrait mode?
Thanks in advance.
Use the UIViewControllers delegate method: - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
It will get called everytime the orientation changes. A simple if statement should then check and decide when to set the tabbar hidden like so:
pseudo code:
if (toInterfaceOrientation == landscape)
[[self tabbarcontroller]tabbar sethidden:YES];
else
[[self tabbarcontroller]tabbar sethidden:NO];
if (toInterfaceOrientation == landscape)
self.tabBarController.tabBar.hidden = YES;
else
self.tabBarController.tabBar.hidden = NO;

How to draw UIViewController in full screen when push from NavigationController?

my ViewController will start draw under of NavigationBar it will reduce ViewController to 436*320 pixels
how can i force it to draw in full screen 480*320
You could hide the navigation bar:
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[self navigationController] setNavigationBarHidden:YES animated:NO];
}
Modal view? -presentModalViewController:animated:, you can set the style (slide up, flip, dissolve, page curl) with the modalTransitionStyle property (on the view controller to become modal)
If I'm understanding your problem is with the status bar and not the navigation bar..
Try to add the following lines in your info.plist file:
<key>UIStatusBarHidden</key>
<true/>
This way the application will be in full-scream.
You also try:
[UIApplication sharedApplication].statusBarHidden = YES;

Make staus bar visible without overlapping view

I have a tab bar with two views. In the first view the iPhone status bar is hidden using [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES]. When the second view is loaded, and the status bar is made visible again using [[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES] it overlaps the view. How do I make the status bar visible again without overlapping the second view?
Thanks
Try this code.
The dot is a dash..
(void)viewWillAppear:(BOOL)animated {
// to fix the controller showing under the status bar
self.view.frame = [[UIScreen mainScreen] applicationFrame];
}