zoukankan      html  css  js  c++  java
  • UIImagePickerController导航字体颜色和背景

    创建UIImagePickerController 

     // 创建图片选择器
                UIImagePickerController *picker = [[UIImagePickerController alloc] init];
                picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;
                picker.allowsEditing = YES;
                picker.delegate = self;

                 //设置导航栏背景颜色

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

                 //设置右侧取消按钮的字体颜色

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

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

    右侧取消按钮的字体方式无效可使用代理方法

    - (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];
    }
  • 相关阅读:
    前端必须掌握的 docker 技能(2)
    前端必须掌握的 docker 技能(1)
    异步 map 和模块打包
    import 和组件库按需引入
    babel-node 和 nodemon
    linux和mac 终端代理
    yarn.lock 是干什么的
    pwa 总结
    设计模式(5): vue 不监听绑定的变量
    django+celery+redis应用
  • 原文地址:https://www.cnblogs.com/Milo-CTO/p/7447108.html
Copyright © 2011-2022 走看看