xcode combine calayer into an image
let topImage = UIImage(named: "image1.png")
let bottomImage = UIImage(named: "image2.png")
let size = CGSize(width: topImage!.size.width, height: topImage!.size.height + bottomImage!.size.height)
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
topImage!.draw(in: CGRect(x: 0, y: 0, width: size.width, height: topImage!.size.height))
bottomImage!.draw(in: CGRect(x: 0, y: topImage!.size.height, width: size.width, height: bottomImage!.size.height))
let newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
//set finalImage to IBOulet UIImageView
mergeImage.image = newImage
Also in Swift:
- rounded ios button
- ForEach tabs swiftui
- swift 5 progress bar height
- register for remote notifications swift
- chating App in swift
- swift doc comments
- swift animate add subview
- swift empty an array
- swift list
- swift access appdelegate from viewcontroller
- swift generate random number
- add shadow to collection view cell swift
- uiimage swift src url
- swift change navigation bar title
- declare function in swift
- swift has Top Notch
- rotate image animated swift
- use timer swift
- change font swiftui
- how to pass state variable in swiftui
- swift set uiimage color
- how to screen record swift stackoverflow
- how to add an underline to a textField swift
- variadic parameters swift