美文网首页
导航栏的风格设置

导航栏的风格设置

作者: 高乔人 | 来源:发表于2018-05-30 14:26 被阅读8次

- (void)setTitleStyle {

    // 标题

    NSShadow*shadow = [[NSShadowalloc]init];

    [shadowsetShadowOffset:CGSizeZero];

    [shadowsetShadowColor:[UIColor clearColor]];

    NSDictionary *attributes = @{NSShadowAttributeName:shadow,

                                 NSForegroundColorAttributeName:[UIColorwhiteColor],

                                 NSFontAttributeName:[UIFont systemFontOfSize:18.0]};

    [self.navigationController.navigationBar setTitleTextAttributes:attributes];

}

#pragma mark - 设置导航栏背景

- (void)setNavBarBackground {

    UIImage*bgImg = [CJToolimageWithColor:HEXCOLOR(0x18213f)size:CGSizeMake(kDeviceWidth,64.0)];

    [self.navigationController.navigationBar setBackgroundImage:bgImg forBarMetrics:UIBarMetricsDefault];

    [self.navigationController.navigationBar setShadowImage:[CJTool imageWithColor:HEXCOLOR(0x17a8c1) size:CGSizeMake(kDeviceWidth, 2.0)]];

    [self.navigationController.navigationBar setTranslucent:NO];

    NSArray*viewControllers = [self.navigationControllerviewControllers];

    if(viewControllers.count>1) {

        [selfsetLeftButton:IMAGE(@"icon_back")];

    }

}

相关文章

网友评论

      本文标题:导航栏的风格设置

      本文链接:https://www.haomeiwen.com/subject/hngtsftx.html