UINavigationController

1、不自定义UINavigation更换背景色,可以直接设置naviagationBar的背景色,通过barTintColor 属性设置。

2、UINavigationController作为容器时,会导致子controller被遮挡,可以设置子Controller的 edgesForExtendedLayout 和 automaticallyAdjustScrollViewInsets(自视图是UIScrollView时)解决:

-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // 解决被UINavigationController遮挡
        if([[[UIDevice currentDevice]systemVersion]floatValue]>=7.0)
        {
            self.edgesForExtendedLayout = UIRectEdgeNone;
            self.automaticallyAdjustsScrollViewInsets = NO;
        }
    }
    return self;
}
原文地址:https://www.cnblogs.com/1oo1/p/4166542.html