zoukankan      html  css  js  c++  java
  • iOS 学习笔记27-CALayer

    首先 添加图片到项目

     UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"1"]];

        imageView.center = self.view.center;

        [self.view addSubview:imageView];

     //设置阴影

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

        //阴影偏移

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

        //阴影透明度

        imageView.layer.shadowOpacity = 0.5;

        //阴影圆角大小

        imageView.layer.cornerRadius = 8;

        imageView.layer.masksToBounds = YES;//必须设置这个属性才能圆角

        

        //设置边框

        imageView.layer.borderWidth = 8;

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

        //设置旋转

    //    imageView.layer.transform = CATransform3DMakeRotation(M_PI_4, 1, 1, 0);

        imageView.layer.transform = CATransform3DMakeScale(0.5, 1, 1);

    这里要注意:如果要设置图层圆角,必须要设置

        imageView.layer.masksToBounds = YES;//必须设置这个属性才能圆角

  • 相关阅读:
    期待Eclipse3.4
    Winforms中使用系统托盘图标
    Eclipse下的Struts2开发插件
    彩色 夺冠
    网络&系统
    A Famous Music Composer
    Quick Brown Fox
    解密QQ号——队列
    谁先倒
    bootstrap Table从零开始
  • 原文地址:https://www.cnblogs.com/adodo/p/5222332.html
Copyright © 2011-2022 走看看