ios - Capture screenshot from another ViewController - Obj C -
i using:
cgrect rect = [self.view bounds]; uigraphicsbeginimagecontextwithoptions(rect.size,yes,0.0f); cgcontextref context = uigraphicsgetcurrentcontext(); [self.view.layer renderincontext:context]; uiimage *capturedimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
this retrieves screen shot of current view once uitabbaritem
selected. problem is, capture view
of current view
user active on before switching next view
.
to better understand this. have uitabbarcontroller
manages navigation app. walk in view controller
table want capture picture of when user selects share
uitabbaritem
on navigation. have linked method checks see if share
has been clicked , creates image of current view shown above.
my roadblock is, how can capture image of first view(walk in view) every time no matter view user on?
i handling capturing functionality within custom class initates uitabbarcontroller
suggestions thoughts?
will you?
cgrect rect = [yourtabcontroller.viewcontrollers[walkinviewindex].view bounds]; uigraphicsbeginimagecontextwithoptions(rect.size,yes,0.0f); cgcontextref context = uigraphicsgetcurrentcontext(); [yourtabcontroller.viewcontrollers[walkinviewindex].view.layer renderincontext:context]; uiimage *capturedimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
Comments
Post a Comment