//
//  resize.swift
//  Gengmei
//
//  Created by licong on 2017/4/28.
//  Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//

import UIKit

@objc public extension UIImage {
    ///对指定图片中心进行拉伸
    static func stretchByCenter(name: String) -> UIImage {
        var normal = UIImage(named: name)!
        let imageWidth = normal.size.width * 0.5
        let imageHeight = normal.size.height * 0.5
        normal = normal.resizableImage(withCapInsets: UIEdgeInsets(top: imageHeight, left: imageWidth, bottom: imageHeight, right: imageWidth), resizingMode: .stretch)
        return normal
    }
}
