UIImagePickerController導航字體顏色和背景

建立UIImagePickerController 字體

 // 建立圖片選擇器
            UIImagePickerController *picker = [[UIImagePickerController alloc] init];
            picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;
            picker.allowsEditing = YES;
            picker.delegate = self;

             //設置導航欄背景顏色spa

             picker.navigationBar.barTintColor = HexRGB(0x4294FE);代理

             //設置右側取消按鈕的字體顏色code

             picker.navigationBar.tintColor = [UIColor whiteColor]; // 以富文本方式更改[picker.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:18]}];orm

           [self presentViewController:picker animated:YES completion:nil];

 

右側取消按鈕的字體方式無效可以使用代理方法blog

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [viewController.navigationItem.rightBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]} forState:UIControlStateNormal];
    
    [viewController.navigationItem.leftBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]} forState:UIControlStateNormal];
}
相關文章
相關標籤/搜索