Remove black bar from UIPagingViewController dot indicators - ios

I have a UIPageViewController set up. There's a black bar that appears under the dot indicators. Is there anyway to remove the black bar? Thanks.
UPDATE:
I have learned that the bar you see by the page indicators is part of the UIPageViewController. Therefore making it clear, or any color is just changing the color of the page view controller which lays behind whatever view your on now. So if you have an image as a background and you don't want the bar don't use UIPageViewController.

You can use UIAppearance to change the color of UIPageControl. Otherwise it is not accessible.
UIPageControl *pageControl = [UIPageControl appearance];
pageControl.backgroundColor = [UIColor blueColor];
You can add this code for example in the app's delegate method:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Related

issue setting the tint / translucency level in my navigation bar iOS 7

I am trying to get a nice translucent dark navigation bar for my view. The background image is a nice black and white, so the automatic translucency in the app should be enough, but when I run the app, I get an almost 100% opaque white navigation bar.
I have reviewed many of the questions on the site and tried much of the provided answers without luck, I have looked at this:
Achieving bright, vivid colors for an iOS 7 translucent UINavigationBar'
and this
http://www.appcoda.com/customize-navigation-status-bar-ios-7/
But I still don't get the solution I am seeking, the closes I got was when the view initially appears it has the right levels, as soon as the segue comes to an end, the navigation bar becomes completely opaque. This is the code that I am trying to work with right now:
self.navigationController.navigationBar.alpha= .8f;
self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
self.navigationController.navigationBar.translucent = YES;
and this is the the result I am getting:
Strangely enough, as I mentioned when the segue is presenting the view, the navigation bar has one look and when it is completely presented it has a completely different appearance, see images:
This is before the view fully loads:
and this is right after it has been fully loaded:
I would really appreciate some help, thank you.
EDIT: I tried the following code with no success :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent];
return YES;
}
If you want this style for all the nag bars in your application then i suggest you set the Navigation bar style via the appearance proxy.
In your AppDelegate.m (or whatever your app delegate file is) replace the didFinishLaunchingWithOptions: method with the one below
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent];
return YES;
}
Use UIBarStyleDefault for the usual light translucent bar.
Try this and tell me if it works
I believe this has been a problem since iOS 7.0.3. Try This. Use the color you used before but set the alpha = 0.67.
UIColor * navColor = ...;
self.navigationBar.barTintColor = [navColor colorWithAlphaComponent:0.67];

UISplitView remove app tint color

My app is based on a UISplitViewController on iPad.
There is a functionnality which add a second UISplitViewController over the first.
But this remove the apptint.
I've tried the following code in the first split view when going back on first split view, but it does not work:
-(void)viewWillAppear:(BOOL)animated {
UIWindow *appWindow = [[UIApplication sharedApplication]keyWindow];
[appWindow setTintColor:[UIColor redColor]];
}
I heard there is a bug (8276014 in apple bug report) that seems to match my issue.
Any help?
You can also set an app’s tint color in Interface Builder. The Global Tint menu in the Interface Builder Document section of the File inspector lets you open the Colors window or choose a specific color.
or
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.tintColor = [UIColor redColor];
return YES;
}
or
In iOS 7, tint color is a property of UIView. iOS 7 apps often use a tint to define a key color that indicates interactivity and selection state for UI elements throughout the app.
When you specify a tint for a view, the tint is automatically propagated to all subviews in the view’s hierarchy. Because UIWindow inherits from UIView, you can specify a tint color for the entire app by setting the window’s tint property using code like this:
Setting the tintColor property by using the appearance proxy APIs is not supported in iOS 7.
[[UIView appearance] setTintColor:[UIColor redColor]];//iOS 6

UIStatusBar setTranslucent:NO avoid moving content down

I am trying to get my UINavigationBar and UIStatusBar to be opaque and have no translucency properties whatsoever. I tried using [[UINavigationBar appearance] setTranslucent:NO]; but that moves the view content down a few pixels. I want that content to be under the UINavigationBar. Is there an easy way to do this?
I had the same problem when I used [[UINavigationBar appearance] setTranslucent:NO]; on AppDelegate.m . What worked for me: set "Under Opaque Bars" (see image) property in each ViewController scene under that opaque Navigation Bar
Try to change the following properties for your UIViewControllers for elimination pixels shift effect for iOS7.
First of all, translucent property just can't be set using UIAppearance. Next there is no relation between whether your bars are translucent or opaque & the changed positions of your pixels.
Customizing the Appearance of a Navigation Bar
In iOS 7, a navigation bar’s tintColor affects the color of the back indicator image, button titles, and button images. The barTintColor property affects the color of the bar itself. Additionally, navigation bars are translucent by default. Turning the translucency off or on does not affect buttons, since they do not have backgrounds.
In my IOS app, I need to do the following in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions function
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(#"7.0")) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
//Added on 19th Sep 2013
self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);
}
There is a more detailed discussions here ios-7-status-bar-back-to-ios-6-style

How to get the blurred and translucent effect on a navigation bar in iOS 7?

Problem
My app appears to be laid out correctly, but I cannot achieve the blurry translucent effect that iOS 7 is famous for. Mine appears opaque.
Desired Effect
I'm trying to get a more obvious blur effect such as Apple's Trailers app:
Translucency
In my subclass of UINavigationController, I make the navigation bar translucent:
- (id)initWithRootViewController:(UIViewController *)rootViewController
{
if (self = [super initWithRootViewController:rootViewController]) {
self.navigationBar.translucent = YES;
}
return self;
}
Tint Color
In my subclass of UIApplicationDelegate, I set the tint color of the navigation bar. I discovered that the alpha of the tint color makes no difference. That is, using an alpha of 0.1 would not cause the bar to become more translucent.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UINavigationBar appearance] setTintColor:[UIColor greenColor]];
}
Edges
In my content view controller, I set the edge to UIRectEdgeNone so the top doesn't get chopped off by the navigation bar. If I were to use the default UIRectEdgeAll, the navigation bar would permanently cover the top of my content. Even if I were to live with this abnormality, UIRectEdgeAll still does not enable the translucency effect.
- (void) viewDidLoad
{
[super viewDidLoad];
self.edgesForExtendedLayout = UIRectEdgeNone;
}
Edit: Experimenting with Edges
Ad pointed out by #rmaddy in the comments, the problem may be with the edgesForExtendedLayout. I found a comprehensive tutorial edgesForExtendedLayout and attempted to implement it:
- (void) viewDidLoad
{
[super viewDidLoad];
self.edgesForExtendedLayout = UIRectEdgeAll;
self.automaticallyAdjustsScrollViewInsets = YES;
self.extendedLayoutIncludesOpaqueBars = NO;
}
It did not work. Firstly, there was no translucency effect. Secondly, the top of my content was chopped off. On the following example page with the above code, the avatar was initially covered by the navigation bar and it was very hard to scroll to. You could pull down to see the top of the avatar, but when you let go, the page would automatically bounce back up and the avatar would be obscured again.
The problem was caused by the third party pull-down-to-refresh view EGORefreshTableHeaderView, which was popularly used before iOS 6 introduced the system refresh control.
This view confuses iOS 7, making it think that the content is taller than it really is. For iOS 6 and 7, I've conditionally switched to using UIRefreshControl. Now the navigation bar will not chop off my content. I can use UIRectEdgeAll to make my content go underneath the navigation bar. Finally, I tint my navigation bar with a lower alpha to get the translucency effect.
// mostly redundant calls, because they're all default
self.edgesForExtendedLayout = UIRectEdgeAll;
self.automaticallyAdjustsScrollViewInsets = YES;
self.extendedLayoutIncludesOpaqueBars = NO;
[[UINavigationBar appearance] setTintColor:[UIColor colorWithWhite:0.0 alpha:0.5]];
If you need to achieve exactly the same effect as in the iTunes Store (Dark Blur).
Configure the barStyle attribute of the navigation bar as follows:
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;

iOS7 Side menu status bar color transition. As in the iOS7 Facebook App

The iOS7 Facebook App has a right side menu that can be shown by swiping right to left or clicking on the upper right button. When this menu is opened the there is a color transition in the entire status bar from blue to black and vice-versa when closed.
This image shows both status bar side-to-side
This looks like a very good solution for iOS Apps with side menus.
Any ideas or ways about how to accomplish this?
I am currently using JASidePanels.
Thanks!
I managed to find a very simple, elegant way to do this, that mimics the Facebook app functionality perfectly.
Here's my approach:
Create view with status bar frame
Set view background color to black, opacity to 0
Add view as subview to any root view (you need a view that will cover both the center view and the menus, so that it won't be confined to any single view - a good option for this is the container view controller used by your menu controller implementation)
Set view's opacity in your menu controller implementation's menu animation method
Here's my specific implementation, using MMDrawerController:
I subclassed MMDrawerController (I actually already had a subclass for using MMDrawerController with storyboards), and added this code to the class's init method:
// Setup view behind status bar for fading during menu drawer animations
if (OSVersionIsAtLeastiOS7()) {
self.statusBarView = [[UIView alloc] initWithFrame:[[UIApplication sharedApplication] statusBarFrame]];
[self.statusBarView setBackgroundColor:[UIColor blackColor]];
[self.statusBarView setAlpha:0.0];
[self.view addSubview:self.statusBarView];
}
// Setup drawer animations
__weak __typeof(&*self) weakSelf = self; // Capture self weakly
[self setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
MMDrawerControllerDrawerVisualStateBlock block;
block = (drawerSide == MMDrawerSideLeft) ? [MMDrawerVisualState parallaxVisualStateBlockWithParallaxFactor:15.0] : nil; // Right side animation : Left side animation
if(block){
block(drawerController, drawerSide, percentVisible);
}
[weakSelf.statusBarView setAlpha:percentVisible]; // THIS IS THE RELEVANT CODE
}];
I also added self.statusBarView as a private property.
The first section of code creates a view, configures it, and adds it as a subview of the MMDrawerController subclass's view. The OSVersionIsAtLeastiOS7() method is a custom method that simplifies the check to see if the device is running iOS 7 (if it isn't, your custom view will show up below the status bar, which you don't want).
The second section of code is MMDrawerController's setDrawerVisualStateBlock method, which sets the animations code to be performed when a menu is being opened and closed. The first few lines of code are boilerplate code that sets one of the prebuilt animations blocks to each menu (I wanted parallax on the left, but nothing on the right). The relevant code is the last line of the block: [weakSelf.statusBarView setAlpha:percentVisible];, which sets the status bar view's opacity to match the percentage that the menu is currently open. This allows for the smooth cross animation you see in the Facebook app. You'll also notice I've assigned self to a variable weakSelf, so as to avoid the "retain cycle" compiler warning.
This is my specific approach using MMDrawerController and a subclass, which I did more for convenience because I already had the subclass in place, than because it is necessarily the best approach or the only way to do it. It could probably be implemented in several other ways, using MMDrawerController without a subclass, or using any other side-drawer menu implementation.
The ending result is a smooth fading to black animation behind the status bar, exactly as you see in the new Facebook app.
I've been trying to accomplish the same thing. The method I am using to do this is based on the following concepts:
A background image with a height of 64 points will fill both the
UINavigationBar and the UIStatusBar.
A background image with a height of 44 points will fill the UINavigationBar and leave the
UIStatusBar black.
You can add an subview to the top of the current navigationController's view and it will sit underneath the UIStatusBar.
So, first, you need to create two images with your desired UINavigationBar look:
A 640x128px image to cover navigation bar and status bar (ImageA)
And a 640x88px image to cover the navigation bar but leave the status bar black (ImageB).
In the application:didFinishLaunchingWithOptions: method, set the background of your UINavigationBar with ImageA with [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:#"ImageA.png"] forBarMetrics:UIBarMetricsDefault];
When the side menu starts to open, you are going to want switch the UINavigationBar so it uses ImageB and create a view which you will add underneath the UIStatusBar. Here is some sample code for doing just that:
// Add a property for your "temporary status bar" view
#property (nonatomic, strong) UIView *temporaryStatusBar;
And in the code where the side menu starts to open:
// Create a temporary status bar overlay
self.temporaryStatusBar = [[UIView alloc] initWithFrame:[[UIApplication sharedApplication] statusBarFrame]];
self.temporaryStatusBar.backgroundColor = [UIColor yourColor];
[self.navigationController.view addSubview:self.temporaryStatusBar];
// Update both the current display of the navigationBar and the default appearance values
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:#"imageB.png"] forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:#"imageB.png"] forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setNeedsDisplay];
As the side menu animates open, or as the user pans the menu, all you need to do then is adjust the alpha level of the UIStatusBar overlay. When the side menu is fully open, the UINavigationBar should have ImageB as its background image and the UIStatusBar overlay should have an alpha of 0. When the side menu closes, you'll want to replace the UINavigationBar background with ImageA and remove the UIStatusBar overlay.
Let me know if this works for you!
You can use this awesome slide menu library
https://github.com/arturdev/AMSlideMenu
In this demo project you can see how to do that by writing 4 lines of code.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// Setting navigation's bar tint color
self.navigationController.navigationBar.barTintColor = [UIColor colorWithHex:#"#365491" alpha:1];
// Making view with same color that navigation bar
UIView *statusBarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 20)];
statusBarView.backgroundColor = [UIColor colorWithHex:#"#365491" alpha:1];
// Replace status bar view with created view and do magic :)
[[self mainSlideMenu] fixStatusBarWithView:statusBarView];
}

Resources