[英]How to add a UIImageView over a MPMoviePlayerController | iOS | Objective C
[英]How to add UIView in UIImageView in ios objective c
我想在UIImageView中 添加UIView (UIView包含一些圖像和文本),並且要將該imageview保存到我的Camera Roll中 。 因此,請給我一些建議或快速代碼,以幫助我解決此問題。 單擊此處獲取UIScreen
在我的情況下,我在UIView
添加了一個UIView
和一個UIImageView
貼紙,我想將它們合並,並且我想要以橫向模式顯示圖像
任何幫助或建議,我們將不勝感激。
謝謝。
我有一個類似的任務,並使用了以下代碼:
func getResultImage() throws -> (image: UIImage, path: URL) {
UIGraphicsBeginImageContextWithOptions(bounds.size, false, UIScreen.main.scale)
defer {
UIGraphicsEndImageContext()
}
drawHierarchy(in: self.bounds, afterScreenUpdates: true)
guard let image = UIGraphicsGetImageFromCurrentImageContext() else {
throw ImageEditorViewError.noImageGenerated
}
guard let data = UIImagePNGRepresentation(image) else {
throw ImageEditorViewError.noDataRepresentation
}
let writePath = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("Image.png")
try data.write(to: writePath)
return (image, writePath)
}
您可以使用writePaht刪除部分,因為它專門用於我的任務
假設此代碼位於您的容器視圖內,並且其中包含一些視圖標簽
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.