zoukankan      html  css  js  c++  java
  • 图片拉伸

     办法1

    // MARK: - 获得一个拉伸的图片
    extension UIImage{
         func getTensileImage() -> UIImage{
            let leftCapWidthUnderView = self.size.width * 0.5;
            let topCapHeightUnderView = self.size.height * 0.5
            return self.stretchableImage(withLeftCapWidth: Int(leftCapWidthUnderView), topCapHeight: Int(topCapHeightUnderView))
        }
    }
    

      

    使用

    self.bgView.image = UIImage.init(named: model["bgView"] ?? "")?.getTensileImage()

    办法2
    /*

    * Stretch 拉伸

    * Tile 平铺

    */

            self.bgView.image = UIImage.init(named: model["bgView"] ?? "")?.resizableImage(withCapInsets: UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 40), resizingMode: UIImageResizingMode.stretch)





    转自:https://blog.csdn.net/wc455287693/article/details/47294547

  • 相关阅读:
    hadoop cdh5的pig隐式转化(int到betyarray)不行了
    贝叶斯定理与朴素贝叶斯分类器
    我所见过最全的互联网广告相关介绍
    使用Python做简单的字符串匹配
    awk:快速入门(简单实用19例+鸟哥书内容)
    聚类算法小结
    dubbo 实战
    Mysql查询场景
    深入学习树---二叉树基础
    mysql 索引
  • 原文地址:https://www.cnblogs.com/qingzZ/p/9476360.html
Copyright © 2011-2022 走看看