iphone - How to render UIView into a CGContext -


i wanted render uiview cgcontextref

-(void)methodname:(cgcontextref)ctx {     uiview *someview = [[uiview alloc] init];      magicalfunction(ctx, someview); } 

so, magicalfunction here supposed render uiview(may layer) current context.

how do that?

thanks in advance!

how renderincontext method of calayer?

-(void)methodname:(cgcontextref)ctx {     uiview *someview = [[uiview alloc] init];     [someview.layer renderincontext:ctx]; } 

edit: noted in comment, due difference in origins in 2 coordinate systems involved in process, layer rendered upside-down. compensate, need flip context vertically. technically done scale , translation transformation, can combined in single matrix transformation:

-(void)methodname:(cgcontextref)ctx {     uiview *someview = [[uiview alloc] init];     cgaffinetransform verticalflip = cgaffinetransformmake(1, 0, 0, -1, 0, someview.frame.size.height);     cgcontextconcatctm(ctx, verticalflip);     [someview.layer renderincontext:ctx]; } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -