导航栏和Tabbar分割线隐藏

1.navigationController:

可以在父类里面设置,也可以在部分需要隐藏的子控制器里实现 

[self.navigationController.navigationBar setShadowImage:[UIImage new]];    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];

2:Tabbar:在AppDelegate里,

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

 [[UITabBar appearance] setBarTintColor:[UIColor blackColor]];

    [[UITabBar appearance] setBackgroundImage:[self imageWithColor:[UIColor blackColor]]];

    [[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];

}

-(UIImage*)imageWithColor:(UIColor*)color {

//生成输入色值的图片

    CGRectrect =CGRectMake(0.0f,0.0f,1.0f,1.0f);//宽高 1.0只要有值就够了

    UIGraphicsBeginImageContext(rect.size); //在这个范围内开启一段上下文

    CGContextRef context = UIGraphicsGetCurrentContext();


    CGContextSetFillColorWithColor(context, [color CGColor]);//在这段上下文中获取到颜色UIColor

    CGContextFillRect(context, rect);//用这个颜色填充这个上下文


    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();//从这段上下文中获取Image属性,,,结束

    UIGraphicsEndImageContext();


    returnimage;

}

你可能感兴趣的:(导航栏和Tabbar分割线隐藏)