圆角

sampleView.layer.cornerRadius = 2.5; // 圓角的弧度
sampleView.layer.masksToBounds = YES;

阴影

sampleView.layer.shadowColor = [[UIColor blackColor] CGColor];
sampleView.layer.shadowOffset = CGSizeMake(3.0f, 3.0f); // [水平偏移, 垂直偏移]
sampleView.layer.shadowOpacity = 0.5f; // 0.0 ~ 1.0 的值
sampleView.layer.shadowRadius = 10.0f; // 陰影發散的程度

边框

sampleView.layer.borderWidth = 1;
sampleView.layer.borderColor = [[UIColor blackColor] CGColor];

渐增光泽

CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = sampleView.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor] CGColor], (id)[[UIColor grayColor] CGColor], nil]; // 由上到下的漸層顏色
[sampleView.layer insertSublayer:gradient atIndex:0];

原文地址:IOS UIView圆角,阴影,边框,渐增光泽
标签:圆角   阴影   边框   渐增光泽

智能推荐

IOS UIView圆角,阴影,边框,渐增光泽的更多相关文章

  1. Qt之圆角阴影边框

    Qt的主窗体要做出类似WIN7那种圆角阴影边框,这一直是美工的需求. 这里是有一些门道的,尤其是,这里藏着一个很大的秘密. 这个秘密是一个QT的至少横跨3个版本,存在了2年多的BUG... https ...

  2. iOS UIView添加阴影

    _bottomView.layer.masksToBounds = NO; _bottomView.backgroundColor = [UIColor whiteColor]; _bottomVie ...

  3. 【CSS】圆角阴影边框CSS

    .someClassName { width:300px; display: inline-block; padding: 5px 10px 6px; text-decoration: none; b ...

  4. iOS之用xib给控件设置圆角、边框效果

    xib中为各种控件设置圆角 通过代码的方式设置 @interface ViewController () @property (weak, nonatomic) IBOutlet UIView *my ...

  5. (一一九)通过CALayer实现阴影、圆角、边框和3D变换

    在每个View上都有一个CALayer作为父图层,View的内容作为子层显示,通过layer的contents属性决定了要显示的内容,通过修改过layer的一些属性可以实现一些华丽的效果. [阴影和圆 ...

  6. Qt之阴影边框(转)

    原文地址:http://blog.sina.com.cn/s/blog_a6fb6cc90101eoc7.html 阴影边框很常见,诸如360以及其他很多软件都有类似效果,了解CSS3的同学们应该都知 ...

  7. UITableView section 圆角 阴影

      在UITableView实现图片上面的效果,百度一下看了别人的实现方案有下面2种: 1.UITableView section里面嵌套UITableView然后在上面实现圆角和阴影,  弊端代码超 ...

  8. iOS 自定义方法 - 不完整边框

    示例代码 ///////////////////////////OC.h////////////////////////// ////  UIView+FreeBorder.h//  BHBFreeB ...

  9. iOS设置圆角矩形和阴影效果

    1.设置圆角矩形 //设置dropview属性 _dropView.backgroundColor=[[UIColor whiteColor] colorWithAlphaComponent:0.8] ...

随机推荐

  1. 【RF库Collections测试】Remove Duplicates

    Name:Remove DuplicatesSource:Collections <test library>Arguments:[ list_ ]Returns a list witho ...

  2. head first python 支持网站(可下载所有的代码和示例)

    http://examples.oreilly.com/0636920003434/

  3. 第一个map reduce程序

    完成了第一个mapReduce例子,记录一下. 实验环境: hadoop在三台ubuntu机器上部署 开发在window7上进行 hadoop版本2.2.0 下载了hadoop-eclipse-plu ...

  4. transformClassesWithJarMergingForDebug

    Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.> com.android.build ...

  5. repr方法字符串输出实例对象的值

    #coding=utf-8 #repr方法字符串输出实例对象的值 class CountFromBy(object): def __init__(self, val=0, incr=1): self. ...

  6. c语言学习笔记---预编译

    专题三: 1)       预编译 处理所有的注释,以空格代替, 将所有的#define删除,并且展开所有的宏定义, 处理条件编译指令#if,#ifdef,#elif,#else,#endif 处理# ...

  7. 一个汉字转拼音的php类

    代码来自网上,可用 <?php function Pinyin($_String, $_Code='gb2312') { $_DataKey = "a|ai|an|ang|ao|ba| ...

  8. 节日换肤通用技术方案__iOS端实现

    一.问题的提出 不知道大家有没有发现, 元旦期间, 很多APP界面里的图标都换成了具有节日气氛的样式, 而在过了元旦节之后, 这些图标又悄无声息的变回了本来的面貌. 这些具有短暂生命周期.而又必须在固 ...

  9. <转>Python: __init__.py 用法

    转自 http://www.cnblogs.com/BeginMan/p/3183629.html python的每个模块的包中,都有一个__init__.py文件,有了这个文件,我们才能导入这个目录 ...

  10. Qt获取CPU编号和硬盘序列号

    windows下执行命令除了用cmd之外,还有个东西叫WMIC,非常强大,可以通过他获取很多信息,包括硬件信息. QString frmMain::getWMIC(const QString & ...