ios開發(fā):navigationBar、 tabBar的設(shè)置

//導航欄左右按鈕圖片和文字的顏色(系統(tǒng)自己的圖片和文字)
 self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
 //UIBarMetricsDefault   豎屏格式  高度:44
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigationbar.png"] forBarMetrics:UIBarMetricsDefault];
    //UIBarMetricsCompact   橫屏樣式   高度:32
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-32.png"] forBarMetrics:UIBarMetricsCompact];
//調(diào)導航欄標題的的顏色和大小
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18],NSForegroundColorAttributeName:[UIColor blueColor]}];

//導航頁面的跳轉(zhuǎn)
    [self.navigationController pushViewController:seven  animated:YES];
    [self.navigationController popToRootViewControllerAnimated:YES];
    //self.navigationController.viewControllers  找到push過去的頁面,并放到數(shù)組里面
    NSArray *viewController = self.navigationController.viewControllers;
    [self.navigationController popToViewController:viewController[2] animated:YES];
    #pragma mark - 按鈕的點擊事件
    - (void)buttonClick:(UIButton *)button{
     //返回任意某一頁
    //self.navigationController.viewControllers  找到push過去的頁面,并放到數(shù)組里面
        NSArray *viewController = self.navigationController.viewControllers;
        [self.navigationController popToViewController:viewController[2] animated:YES];
    }
//整體全局更改title的文字和顏色和大小
  NSDictionary *dic = @{NSForegroundColorAttributeName : [UIColor redColor], NSFontAttributeName : [UIFont systemFontOfSize:17.0]};   
 [[UINavigationBar appearance] setTitleTextAttributes:dic];
//設(shè)置選項欄項文字選中和不選中的顯示狀態(tài)(顏色或是大小)
    [nav1.tabBarItem setTitleTextAttributes:dic forState:UIControlStateNormal];
    [nav1.tabBarItem setTitleTextAttributes:selectDic forState:UIControlStateSelected];
//設(shè)置選中tabBar選中后圖片的顏色額
    [self.tabBar setSelectedImageTintColor:[UIColor whiteColor]];
//設(shè)置tabBar樣式
    [self.tabBar setBarStyle:UIBarStyleBlack];
//設(shè)置按鈕跳轉(zhuǎn)到tabBar的任意一個view
    self.tabBarController.selectedViewController = self.tabBarController.viewControllers[1];
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容