zoukankan      html  css  js  c++  java
  • iOS系统navigationBar背景色,文字颜色处理

    - (void)setRightBarButtonItem
    {
        // Create done Button
        UIBarButtonItem *doneButton = [[UIBarButtonItem alloc]initWithTitle:[NSString stringWithFormat:@"确定(%lu/%lu)", (unsigned long)self.selectedAssetURLs.count, (unsigned long)self.maximumNumberOfSelection] style:UIBarButtonItemStylePlain target:self action:@selector(done:)];
    
        [self.navigationItem setRightBarButtonItem:doneButton animated:YES];
    
        UIColor *color = [UIColor colorWithHexString:@"#fe5346"];
        CGRect frame = CGRectMake(0, 0, SCREEN_WIDTH, 64);
        UIImage *image = [UIImage imageWithColor:color withFrame:frame];
        [self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
        self.navigationController.navigationBar.tintColor    = [UIColor whiteColor];
        self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
        self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
    
        
        
        
        
    }
    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        /**
         *  @author SongXing, 15-07-30 14:07:45
         *
         *  UIIMagePickerController颜色修正
         *
         */
        if ([navigationController isKindOfClass:[UIImagePickerController class]] &&
            ((UIImagePickerController *)navigationController).sourceType ==     UIImagePickerControllerSourceTypePhotoLibrary) {
            [[UIApplication sharedApplication] setStatusBarHidden:NO];
            [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
        }
        
        if (navigationController.viewControllers.count != 3) return;
        
        CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
        
        UIView *plCropOverlay = [viewController.view.subviews[1] subviews][0];
        
        plCropOverlay.hidden = YES;
        
        int position = 0;
        
        position = (screenHeight == 568) ? 124 : 80;
        
        CAShapeLayer *circleLayer = [CAShapeLayer layer];
        
        UIBezierPath *path2 = [UIBezierPath bezierPathWithOvalInRect:
                               CGRectMake(0.0f, position, SCREEN_WIDTH, 320.0f)];
        [path2 setUsesEvenOddFillRule:YES];
        
        [circleLayer setPath:[path2 CGPath]];
        
        [circleLayer setFillColor:[[UIColor clearColor] CGColor]];
        UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_WIDTH, screenHeight-72) cornerRadius:0];
        
        [path appendPath:path2];
        [path setUsesEvenOddFillRule:YES];
        
        CAShapeLayer *fillLayer = [CAShapeLayer layer];
        fillLayer.path = path.CGPath;
        fillLayer.fillRule = kCAFillRuleEvenOdd;
        fillLayer.fillColor = [UIColor clearColor].CGColor;
        fillLayer.opacity = 0.8;
        [viewController.view.layer addSublayer:fillLayer];
        
        
    }
  • 相关阅读:
    zabbix 二 zabbix agent 客户端
    zabbix (一:zabbix服务端)
    ssh ip "WARING:REMOTE HOST IDENTIFICATION HAS CHANGED!"
    undefined reference to libiconv_open'
    linux 远程 windows 命令:rdesktop vs windows mstsc
    源码安装mysql
    svn 结合rsync 的代码发布系统
    svn !
    使用rsync 的 --delete参数删除目标目录比源目录多余的文件
    svn 提交冲突(目录下删除文件)
  • 原文地址:https://www.cnblogs.com/songxing10000/p/4884766.html
Copyright © 2011-2022 走看看