zoukankan      html  css  js  c++  java
  • 类似安卓的点9图用法

    //  图1

        UIImageView *imageView =  [[UIImageView alloc] initWithFrame:CGRectMake(100, 300, 200, 74)];

        imageView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];

        imageView.image = [UIImage imageNamed:@"kkk圆角矩形 1"];

        [self.view addSubview:imageView];

        

        

        UIImage *image = [UIImage imageNamed:@"kkk圆角矩形 1"];

        CGFloat top = 0;

        CGFloat left = 50;

        CGFloat bottom = 0;

        CGFloat right = 50;

         /// 顶端、左端、底部、右端分别预留距离

        UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);

         //注意:拉伸之后一定要赋值回去

        image = [image  resizableImageWithCapInsets:insets

                                       resizingMode:UIImageResizingModeStretch];

         //UIImageResizingModeStretch:`拉伸`模式,通过`拉伸`Insets指定的矩形区域来填充图片

         //UIImageResizingModeTile:`平铺`模式,通过`重复显示`Insets指定的矩形区域来填充图片

        

        //  图2

        UIImageView *imageView1 =  [[UIImageView alloc] initWithFrame:CGRectMake(100, 500, 300, 74)];

        imageView1.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];

        imageView1.image = image;

        [self.view addSubview:imageView1];

  • 相关阅读:
    python之进程和线程2
    Python学习笔记7:yield生成迭代器
    Python学习笔记6:装饰器
    Python学习你急5:文件打开与处理
    Python学习笔记4:集合方法
    Python学习笔记3:字典方法
    Python学习笔记2:列表操作方法详解
    Python学习笔记1:字符串方法
    番外篇:Vim使用方法
    Day12: 正则表达式
  • 原文地址:https://www.cnblogs.com/110-913-1025/p/14430247.html
Copyright © 2011-2022 走看看