ios - How to improve the performance of UINavigationController's snapshot -


i use block of code take snapshot of uinavigationcontroller's view:

@implementation uiview (snapshot) - (uiimage*)snapshot {     nstimeinterval t0 = [[nsprocessinfo processinfo] systemuptime];     uigraphicsbeginimagecontextwithoptions(self.frame.size, self.opaque, [[uiscreen mainscreen] scale]);     if([self iskindofclass:[uiscrollview class]]){         cgcontextref ctx = uigraphicsgetcurrentcontext();         cgcontexttranslatectm(ctx, 0, -((uiscrollview*)self).contentoffset.y);     }     [self.layer renderincontext:uigraphicsgetcurrentcontext()];     uiimage *snapshotimage = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();     nstimeinterval t1 = [[nsprocessinfo processinfo] systemuptime];     nslog(@"time cost: %lf", t1 - t0);     return snapshotimage; } @end 

1,

jasidepanelcontroller *sidepanelcontroller = //... uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:sidepanelcontroller]; [navcontroller.view snapshot]; // **cost 1 seconds** 

2,

jasidepanelcontroller *sidepanelcontroller = //... uinavigationcontroller *navcontroller = //...; sidepanelcontroller.centerpanel = navcontroller; [navcontroller.view snapshot]; // **cost 0.1 seconds** 

any methods improve performance?

i found reason: because jasidecontroller add uibezierpath view.layer in (void)stylecontainer:(uiview *)container animate:(bool)animate duration:(nstimeinterval)duration


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -