UIImageView shadowOpacity操作

UIImageView实现阴影处理

UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 50, 50)];;

    imageView.backgroundColor = [UIColor whiteColor];

    //添加边框

    CALayer * layer = [imageView layer];

    layer.borderColor = [[UIColor yellowColor] CGColor];

    layer.borderWidth = 5.0f;

    //添加四个边阴影

    imageView.layer.shadowColor = [UIColor redColor].CGColor;

    imageView.layer.shadowOffset = CGSizeMake(0, 0);

    imageView.layer.shadowOpacity = 0.5;

    imageView.layer.shadowRadius = 3;

    //添加两个边阴影

    imageView.layer.shadowColor = [UIColor redColor].CGColor;

    imageView.layer.shadowOffset = CGSizeMake(10, 1);

    imageView.layer.shadowOpacity = 0.5;

    imageView.layer.shadowRadius = 2.0;

    [self.view addSubview:imageView];

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥iOS动画全貌。在这里你可以看...
    F麦子阅读 5,143评论 5 13
  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥ios动画全貌。在这里你可以看...
    每天刷两次牙阅读 8,572评论 6 30
  • //设置尺寸为屏幕尺寸的时候self.window = [[UIWindow alloc] initWithFra...
    LuckTime阅读 838评论 0 0
  • 1、设置UILabel行间距 NSMutableAttributedString* attrString = [[...
    十年一品温如言1008阅读 1,730评论 0 3
  • 位置: 位于昌润南路与湖南路路囗西侧,望湖小区南区一期临街楼,(原慈铭查体)纯一楼面积约1560平方米,价格...
    WeiLi155阅读 458评论 0 0