iOS 导航条的基本用法

   //导航条标题

    self.navigationItem.title = @"title";

    //导航条返回时文字的设置

    self.navigationController.navigationBar.topItem.title= @"";

    //去掉导航条返回时文字

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


    //导航条返回时箭头颜色的设置

    self.navigationController.navigationBar.tintColor = [UIColor redColor];

    //导航条的颜色

    self.navigationController.navigationBar.barTintColor =[UIColor blackColor];

    //隐藏返回按钮

    self.navigationItem.hidesBackButton = YES;

    

    //设置导航条背景颜色

    [[UINavigationBar appearance]setBarTintColor:[UIColor redColor]];

    //设置导航条背景图片

    [[UINavigationBar appearance]setBackgroundImage:[UIImage imageNamed:@"ios"] forBarMetrics:UIBarMetricsDefault];

    //设置导航条标题的颜色和字体大小

    [self.navigationController.navigationBar setTitleTextAttributes:

     @{NSFontAttributeName:[UIFont systemFontOfSize:19],

        NSForegroundColorAttributeName:[UIColor redColor]}];


你可能感兴趣的:(ios,基本方法)