ios - Merging multiple UIViews -
i using following method merge multiple uiview
's:
targetimageview.addsubview(view1) targetimageview.addsubview(view2) uigraphicsbeginimagecontextwithoptions(targetimageview.bounds.size, false, uiscreen.main.scale) targetimageview.layer.render(in: uigraphicsgetcurrentcontext()!) let combinedimage = uigraphicsgetimagefromcurrentimagecontext()! uigraphicsendimagecontext()
this method works if views static. however, if 1 of views have animated content, video, animation, or gif ... method not work because think takes snapshot of views inside frame of targetimageview
.
what way combine multiple views if 1 of views has non-static content?
let cgrect = cgrect(x: 0, y: 0, width: desirewidthofuiview, height: desireheightofuiview); let view1 = uiview(frame: cgrect) let view2 = uiview(frame: cgrect)
i hope help. :)
wiki
Comments
Post a Comment