Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can take a screenshot of any view or whole screen of the iPhone app with below method</p> <pre><code>- (UIImage *)captureView { //hide controls if needed CGRect rect = [self.view bounds]; UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); [self.view.layer renderInContext:context]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return img; } </code></pre> <p>And call it like bellow...</p> <pre><code>UIImage *tempImageSave=[self captureView]; </code></pre> <p>and you can also save this image with this bellow line for photo album..</p> <pre><code>UIImageWriteToSavedPhotosAlbum(tempImageSave,nil,nil,nil); </code></pre> <p>and you can also save this image with this bellow line for Document Directory..</p> <pre><code>NSData *imageData = UIImagePNGRepresentation(tempImageSave); NSFileManager *fileMan = [NSFileManager defaultManager]; NSString *fileName = [NSString stringWithFormat:@"%d.png",1]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *pdfFileName = [documentsDirectory stringByAppendingPathComponent:fileName]; [fileMan createFileAtPath:pdfFileName contents:imageData attributes:nil]; </code></pre> <p>If the view contains the layer images or some graphics related data then use below method.</p> <pre><code>-(UIImage *)convertViewToImage:(UIView *)viewTemp { UIGraphicsBeginImageContext(viewTemp.bounds.size); [viewTemp drawViewHierarchyInRect:viewTemp.bounds afterScreenUpdates:YES]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } </code></pre> <p>And use this method like below.</p> <pre><code>UIImage *tempImageSave = [self convertViewToImage:yourView]; </code></pre> <p>I hope this helpful for you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload