I have a PPRevealSideViewController and when is being called appears the status bar on top of view.
I initialize it in appDelegate.m like this:
MainViewController *main = [[MainViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:main];
_revealSideViewController = [[RootViewController alloc] initWithRootViewController:nav];
_revealSideViewController.delegate = self;
self.window.rootViewController = _revealSideViewController;
[self.window makeKeyAndVisible];
Could anyone tell me how can I make this disappear, or make it the color of background?
Finally I found the answer.
You have two options (fading is set as default). PPRevealSideOptionsiOS7StatusBarFading and PPRevealSideOptionsiOS7StatusBarMoving.
And you can change the color of status bar like this:
[self.revealSideViewController setFakeiOS7StatusBarColor:<#(UIColor *)#>];
Related
I am changing UITabBarItem title after the user changes his language preferences in the app settings. The problem is that the whole item disappears for a while after this change is made and then appears again with the new title.
In AppDelegate I am initializing UITabBarController:
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.delegate = self;
BFNCategoriesTableViewController *shopViewController = [[BFNCategoriesTableViewController alloc] init];
UINavigationController *shopNavigationController = [[UINavigationController alloc] initWithRootViewController:shopViewController];
shopNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:BFNLocalizedString(kTranslationShop) image:[UIImage imageNamed:#"TabBarShopUnselected"] selectedImage:[UIImage imageNamed:#"TabBarShopSelected"]];
self.tabBarController.viewControllers = #[offersNavigationController,
shopNavigationController,
//wishlistNavigationController,
cartNavigationController,
moreNavigationController];
Then after the translation is downloaded I just set different title like this:
navigationController.title = BFNLocalizedString(kTranslationCart);
Do you have an idea why this happens and eventually how to ovecome this issue?
Thanks.
Firstly, I can't understand regarding code above, how tabBarController is connected with UINavigationController.
You should
self.tabBarController.viewControllers = [NSArray arrayWithObject: shopViewController];
UINavigationController *shopNavigationController = [[UINavigationController alloc] initWithRootViewController: self.tabBarController ];
UINavigationController doesn't have a property is tabBarItem.
Following that:
shopViewController.title = = BFNLocalizedString(kTranslationCart);
It changes a title is on top of navController and title of tabBar as well.
Another way, It can change a tabBarTitle directly.
UITabBar *tabBar = self.tabBarController.tabBar;
UITabBarItem * itemBar = [ [UITabBarItem alloc] initWithTitle:BFNLocalizedString(kTranslationCart)
image:(UIImage *)image // your image
selectedImage:(UIImage *)selectedImage]; // highlighted image
[tabBar setItems:[NSArray arrayWithObject:itemBar
animated:YES ];
I think a first way is enough it must certainly work.
I am trying to create window programmatically in App delegate, but status bar hides. In info.plist it is is not set to YES. The app is perfectly working in this way, but I need to show status bar too.
I have window and navigationController property in AppDelegate.h
here is my didFinishLaunch
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//even when I used customized CGRect and used it initWithFrame, there is no status bar
self.navigationController = [[IEENavigationController alloc] init];
XYZViewController *homeViewController = [[XYZViewController alloc] initWithNibName:#"XYZViewController" bundle:nil];
[navigationController pushViewController:homeViewController animated:YES];
self.window.rootViewController = self.navigationController;
[window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
Thank you in advance
You could add this in the info.plist:
UIViewControllerBasedStatusBarAppearance - YES
then add this method in the view controllers you want to hide the status bar.
-(BOOL)prefersStatusBarHidden { return YES; }
I started using UITabBarController and it is great.
The thing is I have a few views that aren't accessed from the UITabBar
(either presented modal programatically or we want to have a button on the top to jump to them)
The thing is that I want to retain the Tab bar visible in these views.
From my understanding mixing presentViewController and UITabBarController is problematic.
How can I do that? Can I have "hidden" tab bar elements I can reference programatically?
Just to clarify with an example:
Views A,B,C,D are in the tab bar - via the storyboard - everything is peachy.
I NEED to have views E and F clickable from the top navigation (please don't suggest a sliding TabBar or a multiple line UITabBar).
I could just jump to E and F but I want the UITabBar to still be visible so the user can jump from E to A for example.
Just use the good old UINavigationController for every tab and just use [self.navigationController pushViewController:A animated:YES];
That's how the setup looks in code:
SGTabBarViewController *rootVC = [[SGTabBarViewController alloc] init];
SGFirstTabViewController *firstVC = [[SGFirstTabViewController alloc] init];
UINavigationController *navController1 = [[UINavigationController alloc] initWithRootViewController:firstVC];
SGSecondTabViewController *secondVC = [[SGSecondTabViewController alloc] init];
UINavigationController *navController2 = [[UINavigationController alloc] initWithRootViewController:secondVC];
SGThirdTabViewController *thirdVC = [[SGThirdTabViewController alloc] init];
UINavigationController *navController3 = [[UINavigationController alloc] initWithRootViewController:thirdVC];
SGForuthTabViewController *fourhtVC = [[SGForuthTabViewController alloc] init];
UINavigationController *navController4 = [[UINavigationController alloc] initWithRootViewController:fourhtVC];
rootVC.viewControllers = #[navController1, navController2, navController3, navController4];
self.window.rootViewController = rootVC;
[self.window makeKeyAndVisible];
If you want your UITabBar visible on every VC you push just use hidesBottomBarWhenPushed = NO; on it.
However, there is no way to have UITabBar visible on views presented modally.
I'm opening a View from the navigationController, using the NVSlideMenuController. However, I haven't been able to show a Navigation Bar (which I definitely need).
I'm not familiar with NavigationControllers and after following a few tutorials, it still isn't clear enough to me how it works.
This is in the AppDelegate application didFinishLaunching:
IntroViewController* introVC = [[IntroViewController alloc] initWithNibName:#"IntroViewController" bundle:nil];
UIViewController *menuViewController = [[MenuViewController alloc] initWithStyle:UITableViewStyleGrouped]; // Your menu view controller
UIViewController *contentViewController = (UIViewController*)introVC; // The initial content view controller
menuViewController.navigationController.navigationBarHidden = false;
NVSlideMenuController *slideMenuController = [[NVSlideMenuController alloc] initWithMenuViewController:menuViewController andContentViewController:contentViewController];
self.window.rootViewController = slideMenuController;
return YES;
I tried adding the code to put the navbarhidden to false and it doesn't seem to work. Is there something else I missed?
Any help is very appreciated!
MyViewController *myViewController = [[MyViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:myViewController];
self.window.rootViewController = navigationController;
This will set the UINavigationController as your root view controller. If you MUST use NVSlideMenuController (which I have 0 experience with but really don't think it is necessary), then you can do the first two lines I gave you, and set the navigationController as the root for the NCSlideMenuController.
I would recommend Apple's documentation for UINavigationController, it is an extremely useful thing to know:
https://developer.apple.com/LIBRARY/IOS/documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html
Having one main navigation controller in whole application and also one main tabbarcontroller , problem is that when i click om 'more' tab of tabbarcontroller at that time it's showing two navigation bars
to solve this problem i tried to hide my main navigation controllers navigationbar using following code :
self.tabbar.navigationController.navigationBarHidden =YES;
but doing this gives me unexpected result in the form of half navigationbar with half black background.
if any one knows the solution then please help me.
thanks in advance.
make viewController With separate UINavigationController,
put this code in Appdelegate
ViewController *a = [[ViewController alloc] initWithNibName:#"a" bundle:nil];
ViewController *b= [[CreateMeetingViewController alloc] initWithNibName:#"b" bundle:nil];
ViewController *c = [[SettingsViewController alloc] initWithNibName:#"c" bundle:nil];
UINavigationController *nav_1 = [[UINavigationController alloc] initWithRootViewController:a];
UINavigationController *nav_2 = [[UINavigationController alloc] initWithRootViewController:b];
UINavigationController *nav_3 = [[UINavigationController alloc] initWithRootViewController:c];
MainTabBar = [[UITabBarController alloc] init];
MainTabBar.delegate = self;
[MainTabBar setViewControllers:[NSArray arrayWithObjects:nav_1,nav_2,nav_3,nil]];
MainTabBar.view.frame=self.view.frame;
[self.view addSubview:MainTabBar.view];
You can check your .Xib you check the option Top Bar this should be 'None' in the identity inspector.
Write in viewWillAppear, i hope it will be helpful for you
[self.navigationController setNavigationBarHidden:YES animated:YES];