Pre loader

Taking a screenshot of chart view renders black rectangle

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi everyone,

I have a scroll view containing (among others) subviews with SciChart surfaces. I use this method:

 [self.scrollView.layer renderInContext:UIGraphicsGetCurrentContext()];

… to take a screenshot of the whole scroll view (render it as a UIImage). All charts are rendered as black rectangles. Same thing happens if I use “Capture view hierarchy” in XCode – black rectangles where there should be a chart.

Any ideas?

Version
2.0
  • You must to post comments
0
0

Hello,

You can try following method to capture the SciChart view

- (UIImage *)screenShort {

CGRect rect = [self bounds];

UIGraphicsBeginImageContext(CGSizeMake(rect.size.width*[UIScreen mainScreen].scale, rect.size.height*[UIScreen mainScreen].scale));

[self drawViewHierarchyInRect:CGRectMake(.0f, .0f, rect.size.width*[UIScreen mainScreen].scale, rect.size.height*[UIScreen mainScreen].scale) afterScreenUpdates:YES];

UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return img;

}

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies