1

hey guys Im porting my project from ios6 to 7, i have a function to make a screenshot of my view which has a navigation bar, on ios6 it works fine, but on ios7 bar in screenshot becomes black

as you can see from the image, I have a navigation bar at top, a tool bar in the middle and a tab bar at the bottom,

screen shot code.

UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, YES, [[UIScreen mainScreen] scale]);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

the bar is default navigation bar with clear tint clear and translucent set to YES

NickYu
  • 594
  • 1
  • 5
  • 13

1 Answers1

0

Use

[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:NO];

as drawing screenshot method instead.

Check this question for more detailed discussion around your problem.

Community
  • 1
  • 1
zgorawski
  • 2,597
  • 4
  • 30
  • 43