ios - How can I take a snapshot of a view that is out of the visible bounds? -
here's setup:
- main view: (0, 0, 320, 548)
- subview 1: (100, 200, 100, 300);
- subview 2: (320, 0, 320, 548);
as can guess subview 2 not visible still inside main view.
i'm using code taking snapshot:
[subview snapshotviewafterscreenupdates:yes];
what i'm trying take snapshot of subview 2 (that out of visible bounds) , add subview 1 (that visible). imagine if subview 1 thumbnail of subview 2. when hover on window , shows preview.
the problem snapshot view returns black if subview 2 not drawn @ all. there way can solve this?
the snapshot method has been extensively tested , works fine.
edit: can force subview 2 draw itself?
try – better?
uigraphicsbeginimagecontext(yoursubview.frame.size); cgcontextref context = uigraphicsgetcurrentcontext(); [[yoursubview layer] renderincontext: context]; uiimage *screenshot = uigraphicsgetimagefromcurrentimagecontext();
Comments
Post a Comment