iOS系統navigationBar背景色,文字顏色處理

來源:互聯網
上載者:User

標籤:

- (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];        }

 

iOS系統navigationBar背景色,文字顏色處理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.