I am trying to remove status bar from particular View Controller but still it shows blue line when i tried to Hide it so please give some suggestions for that.
[[UIApplication sharedApplication] setStatusBarHidden:YES];
In order to Hide the Status bar from Every View
try putting the code in your appdelegate file. in the applicationDidFinishLaunching method as follows
-(void)applicationDidFinishLaunching:(UIApplication *)application {
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
[window addSubview:tabBarController.view];
}
Related
I have a viewcontroller with an iCarousel.
When I tap on an item that I know how to display an UIalert but, now I want to change view controller to go on an other already created viewcontroller
I'm guessing you need something like this:
MyOtherViewControllersName *vc =[[MyOtherViewControllersName alloc]initWithNibName:#"MyOtherViewControllersName" bundle:nil];
[self presentModalViewController:vc animated:YES];
Just put it in the same method where you're generating the alert message.
How to add UINavigationController to xCode Tab Bar Application Delegate?
My structure is based on xCode Tab Bar Application Delegate, with 2 tabs, First View & Second View respectively. For First View, I added a UITableView. I just want to make use of UINavigationController function [self.navigationController pushViewController:animated:] to push a subview and allow a navigation bar to be shown in subview. After pushing the subview, the tab bar must still be there.
Sounds simple, but I have no idea how to achieve it. Please help.
I started with a Window-based template instead and did this to achieve the same thing.
I created my NavigationControllers and TabBarController in my app delegate manually.
In your:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Add this:
//Seeting up the Navigation controllers and pushing our TableView controllers.
UINavigationController *unvc1 = [[UINavigationController alloc] init];
UINavigationController *unvc2 = [[UINavigationController alloc] init];
[unvc1 pushViewController:someViewController1 animated:NO];
[unvc2 pushViewController:someViewController2 animated:NO];
[someViewController1 release];[someViewController2 release];//Releasing our TableView controllers.
//Setting up the TabBar controller and pushing our Navigation controllers.
UITabBarController *tbvc = [[UITabBarController alloc] init];
tbvc.viewControllers = [NSArray arrayWithObjects:unvc1, unvc2, nil];
[unvc1 release];[unvc2 release]; //releasing our Navigation controllers.
I hope this helps.
I did this using presentModalViewController:animated . I added tabBar Controller in the modalView. In the method didSelectRowAtIndexPath use this presentModalViewController:animated .I might not be perfect but I had the same problem, but now my app works as I need.
I am creating an application which displays map using MKMapView control. I have a button on the map that takes me to different view (information view) using the following code:
InfoViewController *infoViewController = [[InfoViewController alloc] initWithJogInfo:jogInfo];
self.view = infoViewController.view;
Now after going to the information view I want to go back again to the main view which displays the map without having to loose anything. Is NagivationControlller my best option to use in this scenario?
Try this,
InfoViewController *infoViewController = [[InfoViewController alloc] initWithJogInfo:jogInfo];
[self.navigationController pushViewController:infoViewController animated:YES];
[infoViewController release];
once you push viewController back button is available to come back to rootViewController.
I have been struggling for some time with the strange behavior of navigation bar items. I have segmented control on the navigation bar (take a look at the image below)
where List button pushes table view controller with UISearchDisplayController. To show table view controller I use the code as it follows:
if (uiSegmentedControl.selectedSegmentIndex == 1 )
{
DetailsTableVewController* detailsViewController = [[DetailsTableVewController alloc]
initWithList:list];
[self.navigationController pushViewController:detailsViewController animated:YES];
[detailsViewController release];
}
Then to return back I use the following code:
[self.navigationController popViewControllerAnimated:YES];
Although I use the code above to go back to the previous controller when UISearchDisplayController is either active or inactive I have different behavior of the navigation bar items. When UISearchDisplayController is active ALL items disappear from the navigation bar
Does anybody know why it happens?
Thanks in advance.
Moved all navbar initialization code from viewDidLoad to viewWillAppear in controller and it solved the problem
how to hide status bar .
in sdk 3.1 or lower version it is possible by adding this code in
- (void)applicationDidFinishLaunching:(UIApplication *)application{
[application statusBarHidden:TRUE];
}
but in 4.1 this method is not available in delegate class. i can see some site like this
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
it is also not working.
any body know that how it will possible in iPhone sdk 4.1 ?
thanks and regards..
if you are doing it on the applicationDidFinishLaunching: there is an easier way of doing it:
The easiest way to hide the status bar (and this will work on any version) is to go into you Info.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.
I can post scree shots if you need them, just let me know and hope this helps.
Just put in delegate class.
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
It is working for me..I hope this will help you.
Your method is now deprecated for iOS 5. You should use one of the following:
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
In iOS 7 , add the below two items another item to info.plist :
View controller-based status bar appearance = NO
Status bar is initially hidden = YES
Please Add in Your AppDelegate Class
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
(or)
Please Add In your Info.plist file add key View controller-based status bar appearance with value NO.and also add Status bar is initially hidden YES
It is really working for me