zoukankan      html  css  js  c++  java
  • 导航栏底部添加阴影

    //
    // UINavigationBar+JTDropShadow.h
    //
    // Created by james on 9/20/11.
    // http://ioscodesnippet.tumblr.com
    //


    #import

    @interface UINavigationBar (JTDropShadow)

    - (void)dropShadowWithOffset:(CGSize)offset
    radius:(CGFloat)radius
    color:(UIColor *)color
    opacity:(CGFloat)opacity;


    @end




    //
    // UINavigationBar+JTDropShadow.m
    //
    // Created by james on 9/20/11.
    // http://ioscodesnippet.tumblr.com
    //


    #import "UINavigationBar+JTDropShadow.h"

    #import



    @implementation UINavigationBar (JTDropShadow)

    - (void)dropShadowWithOffset:(CGSize)offset
    radius:(CGFloat)radius
    color:(UIColor *)color
    opacity:(CGFloat)opacity {

    // Creating shadow path for better performance
    CGMutablePathRef path = CGPathCreateMutable();
    CGPathAddRect(path, NULL, self.bounds);
    self.layer.shadowPath = path;
    CGPathCloseSubpath(path);
    CGPathRelease(path);

    self.layer.shadowColor = color.CGColor;
    self.layer.shadowOffset = offset;
    self.layer.shadowRadius = radius;
    self.layer.shadowOpacity = opacity;

    // Default clipsToBounds is YES, will clip off the shadow, so we disable it.
    self.clipsToBounds = NO;

    }

    @end


    //用法如下

    - (void)viewDidLoad {
    [super viewDidLoad];
    ...
    [self.navigationController.navigationBar dropShadowWithOffset:CGSizeMake(0, 3)
    radius:1
    color:[UIColor darkGrayColor]
    opacity:1];
    ...
    }

  • 相关阅读:
    异常处理机制中的return关键字
    QuickHit 项目
    kali2.0升级
    sslscan
    RC4弱密码套件检测
    CVE-2017-11882漏洞复现
    应急响应小总结
    服务器日志分析
    《x86汇编语言:从实模式到保护模式 》学习笔记之:第一次编写汇编语言
    nasm不是内部或外部命令
  • 原文地址:https://www.cnblogs.com/mgbert/p/4092469.html
Copyright © 2011-2022 走看看