导航条

作者: 我是菜鸟66666 | 来源:发表于2016-08-06 10:55 被阅读0次

    ////设置导航条颜色

    [self.navigationBarsetBarTintColor:RGBA(55,148,228,1)];

    //设置导航条的标题颜色

    [self.navigationBarsetTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:RGBA(255,255,255,1),UITextAttributeTextColor,nil,UITextAttributeTextShadowOffset,nil,UITextAttributeFont,nil]];

    //隐藏返回按钮的后的文字

    [[UIBarButtonItemappearance]setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -600)

    forBarMetrics:UIBarMetricsDefault];

    //    self.navigationBar.barTintColor=[UIColor whiteColor];

    //设置返回按钮为白色

    self.navigationBar.tintColor=[UIColorwhiteColor];

    self.navigationBar.translucent=NO;

    //透明导航栏

    //    [self.navigationBar setBackgroundImage:[UIImage new]

    //                                                  forBarMetrics:UIBarMetricsDefault];

    //    self.navigationBar.shadowImage = [UIImage new];

    //    self.navigationBar.translucent = YES;

    改变导航条的返回按钮的字

    self.navigationController.navigationBar.backItem.title=@"Hey Now!”;

    状态栏

    info.plist文件中,View controller-based status bar appearance项设为NO

    然后在对应的viewcontroller的里面设置下面这句话

    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];

    //自定义返回按钮

    UIImage*backButtonImage = [[UIImageimageNamed:@"icon_back"]resizableImageWithCapInsets:UIEdgeInsetsMake(0,30,0,0)];

    [[UIBarButtonItemappearance]setBackButtonBackgroundImage:backButtonImageforState:UIControlStateNormalbarMetrics:UIBarMetricsDefault];

    //将返回按钮的文字position设置不在屏幕上显示

    [[UIBarButtonItemappearance]setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMin,NSIntegerMin)forBarMetrics:UIBarMetricsDefault];

    相关文章

      网友评论

          本文标题:导航条

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