objective c - How to capture UIView as UIImage in particular frame? -


hi want covert uiview uiimage in particular frame size kindly me.

  1. i have 'uitableview` added subview of 'uiscrollview' horizontal scroll, table view frame size (0, 0, 12000, 768).

  2. i want convert current visible of uitableview uiimage after scrolling.

example:

if scrolled table view horizontally distance means current visible (150,0,1200,768) means full device screen.

  1. if use following code:

    uigraphicsbeginimagecontext(self.frame.size); [self.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *backgroundimage = uigraphicsgetimagefromcurrentimagecontext(); 

    its capturing frame size of (0, 0, 1200, 768) only.

so, how can set origin of image capturing.

kindly me out.... in advance....

- (uiimage *)rasterizedimageinview:(uiview *)view atrect:(cgrect)rect {     uigraphicsbeginimagecontextwithoptions(rect.size, view.opaque, 0.0);     cgcontextref context = uigraphicsgetcurrentcontext();     cgcontexttranslatectm(context, -rect.origin.x, -rect.origin.y);     [view.layer renderincontext:context];      uiimage *image = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();     return image; } 

this allow capture uiimage particular region within uiview defined cgrect.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -