swift set image size
extension UIImage {
func imageResize (sizeChange:CGSize)-> UIImage{
let hasAlpha = true
let scale: CGFloat = 0.0 // Use scale factor of main screen
UIGraphicsBeginImageContextWithOptions(sizeChange, !hasAlpha, scale)
self.draw(in: CGRect(origin: CGPoint.zero, size: sizeChange))
let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
return scaledImage!
}
}
Also in Swift:
- Decimal to Double conversion in Swift
- how to use alamofire pod in swift 5
- swift edit constraint programmatically
- swift table view needs
- Expression of type 'UIViewController?' is unused warning when pop view controller in swift 3.0
- swift set uiimage color
- swift generate random number
- xcode disable a button
- how to screen record swift stackoverflow
- swift zstack
- how to get index path cell collection view from ui longpress gesture swift
- xcode macosx have view resize when window size changed
- sprite kitYourNextScene
- change the title of a button using Swift
- swift for loop index
- set color for uibutton programmatically swift
- uicolor from hex swift
- shuffle array swift
- check when webview finish loading swift
- swift convert string to ns muteable string
- chating App in swift
- loop key value swift
- how to change the font of buttons programmatically swift
- how to swift pie chart quartzcore framework