logo
down
shadow

Setting NavigationController's NavigationBar translucent property to false causes extra padding


Setting NavigationController's NavigationBar translucent property to false causes extra padding

By : user2954530
Date : November 22 2020, 10:31 AM
like below fixes the issue Ah-ha - got there in the end. When not using a translucent navigation bar you need to ensure that both adjusts scroll view insets and extend edges under opaque bars are set to true on all your view controllers.
Here are the StoryBoard settings:
code :


Share : facebook icon twitter icon
TableView frame with extra y origin in xib after setting top as translucent bar

TableView frame with extra y origin in xib after setting top as translucent bar


By : Paulo Kenobi
Date : March 29 2020, 07:55 AM
I wish did fix the issue. This 64 value is done automatically, by default, by the system, so your content is not below the navigation bar. If you wish to retain control over the insets yourself, add this to your view controller:
code :
- (BOOL)automaticallyAdjustsScrollViewInsets
{
    return NO;
}
self.navigationController.navigationBar.translucent = NO; create an extra gap after navigationBar

self.navigationController.navigationBar.translucent = NO; create an extra gap after navigationBar


By : Sergi Lanau
Date : March 29 2020, 07:55 AM
will be helpful for those in need From iOS7 if you use a translucent bar ( in UINavigationController or UITabbarController) the hosted view controller has as default behavior to extend under them. If you say to set the bar as translucent the color of it it will be a combination of the view under it and bat color. That is normal and the only way is to set translucency to no or apply a background image to navigation bar.
Applying frames manually will lead to unexpected result under auto layout, you must use constraints.
code :
+ (UIImage *) imageWithColor:(UIColor*) color {
    CGRect rect = CGRectMake(0, 0, 1, 1);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, color.CGColor);
    CGContextFillRect(context, rect);
    UIImage *colorImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return colorImage;
}
I got a bug when set NavigationBar translucent

I got a bug when set NavigationBar translucent


By : Fekadu Mathewos
Date : March 29 2020, 07:55 AM
Hope that helps When I set NavigationBar to translucent, I expect that the NavigationBar will not has a shadow line under it, and StatusBar has the same background of the view's background , Try changing your code to
code :
[self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
[self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc]init] forBarMetrics:UIBarMetricsDefault];
Xamarin iOS Setting NavigationController.NavigationBar.Translucent = true; shifts scrollview content upwords

Xamarin iOS Setting NavigationController.NavigationBar.Translucent = true; shifts scrollview content upwords


By : Michael
Date : March 29 2020, 07:55 AM
I wish this help you If you have enabled the AutomaticallyAdjustsScrollViewInsets on iOS 10- or ContentInsetAdjustmentBehavior on iOS 11 and you have added the correct constraints for your scrollView. The scroll view will auto adjust its insets to make the content show under the NavigationBar.
But If you set the NavigationController.NavigationBar.Translucent = true; and use MyScrollView.SetContentOffset(new CGPoint(0, 0), true); to set scrollview at initial position. This will cause your issue: the content seems covered by the Navigation Bar.
code :
MyScrollView.ScrollRectToVisible(new CGRect(0, 0, 5, 5), true);
MyScrollView.SetContentOffset(new CGPoint(0, -NavigationController.NavigationBar.Frame.GetMaxY()), true);
Why does setting `hidesBottomBarWhenPushed` to YES with a translucent navigationBar break push animation?

Why does setting `hidesBottomBarWhenPushed` to YES with a translucent navigationBar break push animation?


By : William Krasser
Date : March 29 2020, 07:55 AM
around this issue I have what I would consider a fairly common setup, but I am seeing a pretty strange animation issue. , Here's what I've found so far:
#1 Top right bar is black
Related Posts Related Posts :
  • consecutive statement need to have ; error in swift
  • Trying to create a 32 bpc NSBitmapImageRep, getting hit with errors
  • Does locationManager:didUpdateLocations: method called at the same time in extension and its containing app
  • Can't get Data using SwiftyJSON
  • Convert String to UnsafeMutablePointer<char_t> in Swift
  • inout param with empty object since nil won't work
  • How to align a mask onto an image
  • compiler forcing self inside static method of a function while using dispatch_sync
  • private static variable in struct
  • Conditional "in" for arrays in Swift
  • Extension for Double to accept String as initializer in Swift
  • Modifying UIButton Programmatically
  • Pass type to generic function and compare
  • How to customise the look of the PFSignUpViewController
  • How to take screen shot programmatically (Swift, SpriteKit)
  • Create multiple UIViews when the user taps the screen
  • Filter Array of [AnyObject] in Swift
  • How to add ParseUI to a swift project
  • Can Swift enums have multiple raw values?
  • Using a function() variable in a different Class - Swift
  • Masking an image in Swift using CALayer and UIImage
  • KVC without NSObject (NSPredicate)
  • Any? to Dictionary Cast and retrieving value
  • NSCharacterSet.characterIsMember() with Swift's Character type
  • SCNScene: Calculate projected size of an object
  • How to use contains on a swiftyJSON object
  • Index of element in sorted()
  • How do I initialise a new NSDocument instance in Swift?
  • Multiple functions with the same name
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org